cosmic-screencopy-v2

This commit is contained in:
Victoria Brekenfeld 2024-03-12 19:42:48 +01:00 committed by Victoria Brekenfeld
parent 973cfed87b
commit b40d153809
27 changed files with 3647 additions and 2743 deletions

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::{
shell::grabs::SeatMoveGrabState, state::ClientState, utils::prelude::*,
wayland::protocols::screencopy::SessionType,
};
use crate::{shell::grabs::SeatMoveGrabState, state::ClientState, utils::prelude::*};
use calloop::Interest;
use smithay::{
backend::renderer::utils::{on_commit_buffer_handler, with_renderer_surface_state},
@ -29,8 +26,6 @@ use smithay::{
};
use std::sync::Mutex;
use super::screencopy::PendingScreencopyBuffers;
impl State {
fn toplevel_ensure_initial_configure(&mut self, toplevel: &ToplevelSurface) -> bool {
// send the initial configure if relevant
@ -251,14 +246,11 @@ impl CompositorHandler for State {
workspace.commit(surface);
}
}
//handle window screencopy sessions
self.schedule_window_session(surface);
// and refresh smithays internal state
self.common.shell.popups.commit(surface);
}
// and refresh smithays internal state
self.common.shell.popups.commit(surface);
// re-arrange layer-surfaces (commits may change size and positioning)
let layer_output = self
.common
@ -277,34 +269,10 @@ impl CompositorHandler for State {
}
}
let mut scheduled_sessions = self.schedule_workspace_sessions(surface);
// schedule a new render
if let Some(output) = self.common.shell.visible_output_for_surface(surface) {
if let Some(sessions) = output.user_data().get::<PendingScreencopyBuffers>() {
scheduled_sessions
.get_or_insert_with(Vec::new)
.extend(sessions.borrow_mut().drain(..));
}
self.backend.schedule_render(
&self.common.event_loop_handle,
&output,
scheduled_sessions.as_ref().map(|sessions| {
sessions
.iter()
.filter(|(s, _)| match s.session_type() {
SessionType::Output(o) | SessionType::Workspace(o, _)
if &o == output =>
{
true
}
_ => false,
})
.cloned()
.collect::<Vec<_>>()
}),
);
self.backend
.schedule_render(&self.common.event_loop_handle, &output);
}
}
}