From 2b676d72ce71db910d3774aa32add958e7ff0a63 Mon Sep 17 00:00:00 2001 From: kossLAN Date: Mon, 8 Jun 2026 20:31:16 -0400 Subject: [PATCH] cursor_user: ensure cursor position is on live output --- src/cursor_user.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cursor_user.rs b/src/cursor_user.rs index dc3df528..2ff2c0e2 100644 --- a/src/cursor_user.rs +++ b/src/cursor_user.rs @@ -224,6 +224,8 @@ impl CursorUserGroup { if user.output.get().id == output.id { user.set_output(next); user.set_position(x, y); + } else { + user.ensure_position_on_live_output(); } } } @@ -368,6 +370,19 @@ impl CursorUser { self.desired_known_cursor.set(None); } + fn ensure_position_on_live_output(&self) { + let (x, y) = self.pos.get(); + let x_int = x.round_down(); + let y_int = y.round_down(); + let (output, new_x, new_y) = self.group.state.find_closest_output(x_int, y_int); + if self.output.get().id != output.id { + self.set_output(&output); + } + if (x_int, y_int) != (new_x, new_y) { + self.set_position(x.apply_fract(new_x), y.apply_fract(new_y)); + } + } + fn is_active(&self) -> bool { self.group.active_id.get() == Some(self.id) }