1
0
Fork 0
forked from wry/wry

cursor_user: ensure cursor position is on live output

This commit is contained in:
kossLAN 2026-06-09 20:33:24 -04:00
parent 22f1d92877
commit b56c1a1b0a
No known key found for this signature in database
3 changed files with 24 additions and 2 deletions

View file

@ -414,6 +414,8 @@ impl CursorUser {
x = x.apply_fract(x_tmp); x = x.apply_fract(x_tmp);
y = y.apply_fract(y_tmp); y = y.apply_fract(y_tmp);
} }
let x_int = x.round_down();
let y_int = y.round_down();
if self.software_cursor() if self.software_cursor()
&& let Some(cursor) = self.cursor.get() && let Some(cursor) = self.cursor.get()
{ {

View file

@ -534,6 +534,25 @@ impl WlSeatGlobal {
self.cursor_user_group.latest_output() self.cursor_user_group.latest_output()
} }
pub(crate) fn handle_output_disconnected(
self: &Rc<Self>,
output: &Rc<OutputNode>,
target: &Rc<OutputNode>,
) {
let old_output = self.pointer_cursor.output().id;
let old_position = self.pointer_cursor.position_int();
self.cursor_user_group.output_disconnected(output, target);
let new_output = self.pointer_cursor.output().id;
let new_position = self.pointer_cursor.position_int();
if old_output == new_output && old_position == new_position {
return;
}
self.pos_time_usec.set(self.state.now_usec());
self.changes.or_assign(CHANGE_CURSOR_MOVED);
self.pointer_stack_modified.set(true);
self.apply_changes();
}
pub fn get_keyboard_node(&self) -> Rc<dyn Node> { pub fn get_keyboard_node(&self) -> Rc<dyn Node> {
self.keyboard_node.get() self.keyboard_node.get()
} }

View file

@ -388,8 +388,9 @@ impl ConnectorHandler {
for group in on.ext_workspace_groups.lock().drain_values() { for group in on.ext_workspace_groups.lock().drain_values() {
group.handle_destroyed(); group.handle_destroyed();
} }
for seat in self.state.globals.seats.lock().values() { let seats: Vec<_> = self.state.globals.seats.lock().values().cloned().collect();
seat.cursor_group().output_disconnected(&on, &target); for seat in seats {
seat.handle_output_disconnected(&on, &target);
} }
for item in on.tray_items.iter() { for item in on.tray_items.iter() {
item.destroy_node(); item.destroy_node();