-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Destroy layer shell surfaces instead of layer shell for freeze-feat #115
Destroy layer shell surfaces instead of layer shell for freeze-feat #115
Conversation
While it doesn't throw error anymore, the wayshot process hangs until manually killed, and the screenshot itself isn't copied into
|
Reading the protocol, it seems that unmapping the layer shell surface by committing a null buffer to it is necessary before destruction. Have tested this on sway, river and Hyprland. Can you test this too @Gigas002 ? |
Works great now 👍 |
@CheerfulPianissimo Would you like me to review and merge this PR? |
libwayshot/src/lib.rs
Outdated
@@ -452,6 +452,8 @@ impl WayshotConnection { | |||
} | |||
}; | |||
|
|||
let mut layer_shell_surfaces = 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.
We know the wl_output count right? Can we just make a static array to reduce allocations?
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.
That should be possible, I'll look into it.
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.
Actually, no, we don't know the wl_output count at compile time so I can't see how we could use a simple static array. What we can do is use Vec::with_capacity to init the vec with the number of output frames, is this what you meant?
Yes, freeze feat with clipboard is unusable on some compositors without this. Up to you if you want it merge it as it is or want to wait fot the static allocation change @Shinyzenith . |
What do you mean by static allocation change? Do you have any pr/issue/code sample i can look at? |
This chnage you requested @Shinyzenith #115 (comment) |
Ah my apologies, I am forgetful. Would be ideal to get it done first. Thank you for your help sooraj, much appreciated. |
debug!("Unmapping and destroying layer shell surfaces."); | ||
for (surface, layer_shell_surface) in layer_shell_surfaces.iter() { | ||
surface.attach(None, 0, 0); | ||
surface.commit(); //unmap surface by committing a null buffer |
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.
Note: I am approving and merging the PR for now but I am unsure if this is correct
Attempts to solve the freeze feature crashing sporadically as described in #109 (comment)
#109 (comment) :
@Gigas002 can you test this fix?