From 71fc85170557938ebb402d48350e087204183bcc Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Wed, 7 Feb 2024 21:43:01 +0100 Subject: [PATCH] render: keep track of outputs whose hardware cursor must be rendered --- src/compositor.rs | 1 + src/ifs/wl_seat.rs | 4 ++++ src/tasks/connector.rs | 1 + src/tree/output.rs | 1 + 4 files changed, 7 insertions(+) diff --git a/src/compositor.rs b/src/compositor.rs index 190b18f8..2524bbf1 100644 --- a/src/compositor.rs +++ b/src/compositor.rs @@ -392,6 +392,7 @@ fn create_dummy_output(state: &Rc) { hardware_cursor: Default::default(), update_render_data_scheduled: Cell::new(false), screencasts: Default::default(), + hardware_cursor_needs_render: Cell::new(false), }); let dummy_workspace = Rc::new(WorkspaceNode { id: state.node_ids.next(), diff --git a/src/ifs/wl_seat.rs b/src/ifs/wl_seat.rs index d68f9f9b..d9dabe6e 100644 --- a/src/ifs/wl_seat.rs +++ b/src/ifs/wl_seat.rs @@ -258,6 +258,7 @@ impl WlSeatGlobal { let (x, y) = self.get_position(); for output in self.state.root.outputs.lock().values() { if let Some(hc) = output.hardware_cursor.get() { + let render = render | output.hardware_cursor_needs_render.take(); let scale = output.preferred_scale.get(); let extents = cursor.extents_at_scale(scale); if render { @@ -290,6 +291,9 @@ impl WlSeatGlobal { hc.set_enabled(true); hc.set_position(x_rel + extents.x1(), y_rel + extents.y1()); } else { + if render { + output.hardware_cursor_needs_render.set(true); + } hc.set_enabled(false); } hc.commit(); diff --git a/src/tasks/connector.rs b/src/tasks/connector.rs index 2d7ac31f..e3d1a2e9 100644 --- a/src/tasks/connector.rs +++ b/src/tasks/connector.rs @@ -128,6 +128,7 @@ impl ConnectorHandler { jay_outputs: Default::default(), screencasts: Default::default(), update_render_data_scheduled: Cell::new(false), + hardware_cursor_needs_render: Cell::new(false), }); self.state.add_output_scale(on.preferred_scale.get()); let mode = info.initial_mode; diff --git a/src/tree/output.rs b/src/tree/output.rs index 53379c43..933188c4 100644 --- a/src/tree/output.rs +++ b/src/tree/output.rs @@ -61,6 +61,7 @@ pub struct OutputNode { pub lock_surface: CloneCell>>, pub preferred_scale: Cell, pub hardware_cursor: CloneCell>>, + pub hardware_cursor_needs_render: Cell, pub update_render_data_scheduled: Cell, pub screencasts: CopyHashMap<(ClientId, JayScreencastId), Rc>, }