Skip to content
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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions libwayshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ impl WayshotConnection {
}
};

let mut layer_shell_surfaces = Vec::with_capacity(frames.len());

for (frame_copy, frame_guard, output_info) in frames {
tracing::span!(
tracing::Level::DEBUG,
Expand Down Expand Up @@ -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
Copy link
Member

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

layer_shell_surface.destroy();
}
event_queue.roundtrip(&mut state)?;

callback_result
}

Expand Down
Loading