-
-
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
Merged
Shinyzenith
merged 4 commits into
waycrate:freeze-feat-andreas
from
CheerfulPianissimo:fix-freeze-layer-shell-destroy
May 28, 2024
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
19e3ee8
[fix] destroy layer_shell_surfaces instead of the layer_shell
CheerfulPianissimo f0cd9f4
[fix] unmap layer shell surfaces before destroying them
CheerfulPianissimo 78f022b
[style] correct a typo in the comments
CheerfulPianissimo 069441f
[fix] initialize surface_layer vec with correct capacity
CheerfulPianissimo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -452,6 +452,8 @@ impl WayshotConnection { | |
} | ||
}; | ||
|
||
let mut layer_shell_surfaces = Vec::new(); | ||
|
||
for (frame_copy, frame_guard, output_info) in frames { | ||
tracing::span!( | ||
tracing::Level::DEBUG, | ||
|
@@ -491,15 +493,23 @@ impl WayshotConnection { | |
|
||
debug!("Committing surface with attached buffer."); | ||
surface.commit(); | ||
|
||
layer_shell_surfaces.push((surface, layer_surface)); | ||
event_queue.blocking_dispatch(&mut state)?; | ||
|
||
Ok(()) | ||
})?; | ||
} | ||
|
||
let callback_result = callback(); | ||
layer_shell.destroy(); | ||
event_queue.blocking_dispatch(&mut state)?; | ||
|
||
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 commentThe 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 |
||
layer_shell_surface.destroy(); | ||
} | ||
event_queue.roundtrip(&mut state)?; | ||
|
||
callback_result | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?