Skip to content

Commit

Permalink
Merge branch 'waycrate:freeze-feat-andreas' into freeze-feat-andreas
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigas002 authored May 30, 2024
2 parents 2ae62ce + 2dd8af6 commit b8774ae
Showing 1 changed file with 13 additions and 3 deletions.
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
layer_shell_surface.destroy();
}
event_queue.roundtrip(&mut state)?;

callback_result
}

Expand Down

0 comments on commit b8774ae

Please sign in to comment.