From 296b6bee23ed886140e10cd573747e04b171a570 Mon Sep 17 00:00:00 2001 From: Skygrango Date: Fri, 5 Jun 2026 23:35:29 +0800 Subject: [PATCH] wayland: reject cursor hint requests that are outside the surface bound --- src/input/mod.rs | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/input/mod.rs b/src/input/mod.rs index a2863d09..da3014ae 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2393,7 +2393,7 @@ impl State { }); if let Some((output, geometry, surface_offset)) = found { - let mut pos_in_element = location + surface_offset.to_f64(); + let pos_in_element = location + surface_offset.to_f64(); let window_size = geometry.size.to_f64(); let is_legal = |p: Point| { @@ -2417,29 +2417,13 @@ impl State { let workspace_origin = output.geometry().loc.to_f64(); let origin = geometry.loc.to_f64(); - if !is_legal(pos_in_element) { - let original_global = pointer.current_location(); - - let original_pos_in_element = Point::new( - original_global.x - workspace_origin.x - origin.x, - original_global.y - workspace_origin.y - origin.y, - ); - - let y_only_pos = Point::new(original_pos_in_element.x, pos_in_element.y); - let x_only_pos = Point::new(pos_in_element.x, original_pos_in_element.y); - - if is_legal(y_only_pos) { - pos_in_element = y_only_pos; - } else if is_legal(x_only_pos) { - pos_in_element = x_only_pos; - } else { - pos_in_element = original_pos_in_element; - } + if is_legal(pos_in_element) { + let x = workspace_origin.x + origin.x + pos_in_element.x; + let y = workspace_origin.y + origin.y + pos_in_element.y; + Some((Point::new(x, y), output.clone())) + } else { + None } - - let x = workspace_origin.x + origin.x + pos_in_element.x; - let y = workspace_origin.y + origin.y + pos_in_element.y; - Some((Point::new(x, y), output.clone())) } else { None }