-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat: support mutiscreen when slurp #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f91811c to
b690fc3
Compare
wayshot/src/wayshot.rs
Outdated
|
|
||
| let frame_copy: libwayshot::FrameCopy = if args.is_present("slurp") { | ||
| let frame_copy: (Vec<libwayshot::FrameCopy>, Option<(i32, i32)>) = if args.is_present("slurp") { | ||
| let mut copies = Vec::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does copies signify in this patch? Can we possibly try a better name?
wayshot/src/wayshot.rs
Outdated
|
|
||
| if !(width <= 0 || height <= 0) { | ||
| intersecting_outputs.push(output); | ||
| let truex = region.x_coordinate - output.dimensions.x; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let truex = region.x_coordinate - output.dimensions.x; | |
| let true_x = region.x_coordinate - output.dimensions.x; |
wayshot/src/wayshot.rs
Outdated
| if !(width <= 0 || height <= 0) { | ||
| intersecting_outputs.push(output); | ||
| let truex = region.x_coordinate - output.dimensions.x; | ||
| let truey = region.y_coordinate - output.dimensions.y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let truey = region.y_coordinate - output.dimensions.y; | |
| let true_y = region.y_coordinate - output.dimensions.y; |
wayshot/src/wayshot.rs
Outdated
| intersecting_outputs.push(output); | ||
| let truex = region.x_coordinate - output.dimensions.x; | ||
| let truey = region.y_coordinate - output.dimensions.y; | ||
| let trueregion = CaptureRegion { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let trueregion = CaptureRegion { | |
| let true_region = CaptureRegion { |
wayshot/src/wayshot.rs
Outdated
| }; | ||
| intersecting_outputs.push(MutiCaptureMessage { | ||
| output: output.wl_output.clone(), | ||
| region: trueregion, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| region: trueregion, | |
| region: true_region, |
wayshot/src/wayshot.rs
Outdated
| &mut globals, | ||
| &mut conn, | ||
| cursor_overlay, | ||
| ouputinfos.output.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ouputinfos.output.clone(), | |
| output_info.output.clone(), |
wayshot/src/wayshot.rs
Outdated
| &mut conn, | ||
| cursor_overlay, | ||
| ouputinfos.output.clone(), | ||
| Some(ouputinfos.region), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Some(ouputinfos.region), | |
| Some(output_info.region), |
| &mut conn, | ||
| cursor_overlay, | ||
| output, | ||
| None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be efficient to capture the entire wl_output? Maybe we should consider passing in the intersecting region only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean about entire wl_output? maybe combining all screens together to one image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mstoekcl one just concat the screens, if you want to capture the whole region, just caculate the biggest region, from the min (x, y) to the max (x, y), make every screen capture once, resize and overlay the images together, then we get the whole screens image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| output, | ||
| None, | ||
| )?], | ||
| None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again, maybe we should consider exporting the intersecting capture region and then blit the resulting output to the final buffer.
|
For reference: https://github.com/mstoeckl/wayshot/tree/multi-output |
4e0677c to
929a396
Compare
2ffa974 to
cb68d82
Compare
b6e24cb to
047137a
Compare
|
Apart from some minor style issues ( which I will fix after merging ), the code seems to be fine. We can do a better job of abstracting some areas which I'll also take upon myself. Waiting to merge before I can actually test the patch or have someone test it locally. |
I finally had some time to look at and test this. (Inside sway, I ran I've only noticed one issue so far: transformed outputs are not properly handled; the screenshot buffers need to be untransformed and composited in the right location. However, transformed outputs also having rotated screenshot images may also be an issue with the original wayshot -- or possibly even the protocol https://wayland.app/protocols/wlr-screencopy-unstable-v1 itself, which does not appear to explain whether the buffers received are transformed. Either way, I still consider this PR to be a strict improvement. |
Hey! Thanks once again for taking a look ❤️.
This makes me curious, does this issue occur on grim too? Would you mind testing it out? 😅 I sadly don't have access to anything apart from my laptop at the moment. |
It does not happen with |
I think we need to get the rotation of the screen, before make them one image, it need to rotate the image to the right place Here, transfrom message need to collected https://wayland.app/protocols/wayland#wl_output:enum:transform introduction is here, but I do not know what is a good way to save them in OutputInfo, because they are all in wl_output. so .. If transform is done, then before https://github.com/waycrate/wayshot/pull/40/files#diff-07c5f12242ede0fe1716dbe6393d6cd3a4eb49b4e440dbfed36a1e4bbc1e0651R266 this line, we need to rotate the image to the right place with the transform we get, then make them together, after that , I think all is done so this pr just support when all screen is in normal translation |
|
I try to solve transform in my repo, Decodetalkers/haruhishot@8bc7f4d but there is still some problem , when rotate with 90 and 270, it cannot shot the right place, I need to see how grim handle it it seems something wrong with capture_region, I think it is the bug of sway, because rotate 90 degree, capture region from 0, 0, 100, 100, it captures from 2400, 1000, -100, -100, and grim does not use capture_region. it capture all the screens, and caculate where to cut, finally makes an image |
wayshot/src/wayshot.rs
Outdated
| let mut buff = Cursor::new(Vec::new()); | ||
|
|
||
| let mut writer = BufWriter::new(stdout.lock()); | ||
| image_bottom.write_to(&mut buff, image::ImageFormat::Png)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I didn't notice this line, but should we not take the users defined extension format into consideration here instead of hardcoding png or am I mistaken? @Decodetalkers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I have missed that
I see I'll try and test this theory. |
I think we can query the transform and keep it in a |
I can reproduce this issue under swayfx. |
Closes: #7 Closes: #8 Supercedes: #40 Signed-off-by: Decodetalkers <[email protected]> Signed-off-by: Shinyzenith <[email protected]>
Closes: #7 Closes: #8 Supercedes: #40 Signed-off-by: Decodetalkers <[email protected]> Signed-off-by: Shinyzenith <[email protected]>
|
Completed in: #41 |
|
Thank you for all your help and contributions ❤️ |
fix: #8