Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Shinyzenith
Copy link
Member

I attempted to clean up the code a little bit and introduce some style changes to the same PR. The original author has been credited in the commit sign off.

@mstoeckl @Decodetalkers

Supercedes: #40

@Shinyzenith Shinyzenith force-pushed the multi-output-composited branch from c7bd815 to 63ab617 Compare June 27, 2023 14:24
Decodetalkers
Decodetalkers previously approved these changes Jun 27, 2023
@Shinyzenith
Copy link
Member Author

I think once we can figure out the transform issue, this PR will be ready to merge?

@mstoeckl
Copy link
Contributor

mstoeckl commented Jul 1, 2023

@Decodetalkers said, in #40 :

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

This is definitely a bug in Sway. The documentation for zwlr_screencopy_manager_v1::capture_output_region states that "The region is given in output logical coordinates, see xdg_output.logical_size.". For a square (e.g. 1000x1000 pixel) output, changing the geometry transform will not affect the logical size of the output; in all cases, the compositor will render the same image, just transformed differently. As a result, capturing a specific output region should produce the same result/capture the same area, no matter which geometry transform was applied. Testing with wayshot and e.g. swaymsg output WL-1 transform 90 vs swaymsg output WL-1 transform 0 confirms that Sway does not always capture the same logical region, as it should.

A test script, in case it is useful:

#!/bin/sh
# requires square output for best results
swaymsg output '*' transform 0
wayshot -s '0,0 100x100' -f test-0.png
swaymsg output '*' transform 90
wayshot -s '0,0 100x100' -f test-90.png
swaymsg output '*' transform 180
wayshot -s '0,0 100x100' -f test-180.png
swaymsg output '*' transform 270
wayshot -s '0,0 100x100' -f test-270.png
swaymsg output '*' transform flipped
wayshot -s '0,0 100x100' -f test-0f.png
swaymsg output '*' transform flipped-90
wayshot -s '0,0 100x100' -f test-90f.png
swaymsg output '*' transform flipped-180
wayshot -s '0,0 100x100' -f test-180f.png
swaymsg output '*' transform flipped-270
wayshot -s '0,0 100x100' -f test-270f.png
swaymsg output '*' transform 0

I've filed an MR that fixes the issue at https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4249 .

Edit: it has been merged; we should all test transform handling using wlroots built from git master, from now on.

I think once we can figure out the transform issue, this PR will be ready to merge?

At least part of the transform issue isn't something wayshot can fix.

@Shinyzenith
Copy link
Member Author

Thank you for the comprehensive report. ❤️

@Shinyzenith
Copy link
Member Author

Shinyzenith commented Jul 2, 2023

I'm really sorry. I'm stupid. I forgot to change the branch.

Also would you guys mind if I add you both as repo collaborators, would be helpful to have the patch branches here itself. Let me know if you're interested.

@waycrate waycrate deleted a comment from Decodetalkers Jul 2, 2023
@Decodetalkers
Copy link
Collaborator

It's not rotated at all. @Decodetalkers Are you testing this branch or your branch? I tested with your branch again and it seems to work. With this branch it doesn't.

I'll try to find the issue. Also would you guys mind if I add you both as repo collaborators, would be helpful to have the patch branches here itself. Let me know if you're interested.

I test mime, it works, so I don't have clue why this branch not work.. emm..

I will feel glad if I can help

@Shinyzenith
Copy link
Member Author

Nope I'm just stupid. It works fine.

Closes: #7
Closes: #8
Supercedes: #40
Signed-off-by: Decodetalkers <[email protected]>
Signed-off-by: Shinyzenith <[email protected]>
Signed-off-by: Shinyzenith <[email protected]>
* If they do not conflict then debug logs can disrupt image data.

Signed-off-by: Shinyzenith <[email protected]>
@Shinyzenith Shinyzenith force-pushed the multi-output-composited branch from d8d3137 to ffb2543 Compare July 2, 2023 07:24
@Shinyzenith
Copy link
Member Author

Shinyzenith commented Jul 2, 2023

I have written a solution to multi-output transformed screenshots with reference to the commit that @Decodetalkers made: 0d9ed3f.

I need to find an ergonomic way to do the same for single output screenshots and I think this PR will be ready.

@Shinyzenith Shinyzenith force-pushed the multi-output-composited branch 3 times, most recently from 1c44efa to 0d9ed3f Compare July 2, 2023 12:19
@Shinyzenith
Copy link
Member Author

I have fixed single output transforms handling too. I will do some cleanup and commit it.

@Shinyzenith
Copy link
Member Author

@mstoeckl @Decodetalkers Thank you so much for your help, it would be impossible to get this PR finished without you guys. I have completed transform handling and committed it.

If you guys can leave a review that would help a lot. I'll rebase and merge after the review.

@Shinyzenith Shinyzenith force-pushed the multi-output-composited branch from 0d9ed3f to 11dc370 Compare July 2, 2023 14:45
@Shinyzenith Shinyzenith requested a review from Decodetalkers July 2, 2023 14:45
@Shinyzenith Shinyzenith force-pushed the multi-output-composited branch from 11dc370 to 1e4af0d Compare July 2, 2023 15:08
Copy link
Collaborator

@Decodetalkers Decodetalkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is good.

@Shinyzenith Shinyzenith merged commit 7ffcd77 into main Jul 3, 2023
@Shinyzenith
Copy link
Member Author

Merged to main branch.

@Shinyzenith Shinyzenith deleted the multi-output-composited branch July 3, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants