From dda2d148328d84fe7c1e0e5c4bf126c11a3d1f1b Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 13 Jul 2026 19:35:14 -0700 Subject: [PATCH] input: Send `wl_pointer.motion` on warp, and applying constraint hint Gnome seems to send `motion` in these cases. The spec isn't 100% explicit, but it seems `motion` events are needed for the client to have the same understanding of where the pointer is as the compositor, which generally seems to be desired. This is also needed for toplevel cursor image-copy to get the position change. Likewise, we want image-copy to have the same understanding of where the cursor is as the compositor and client. --- src/input/mod.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/input/mod.rs b/src/input/mod.rs index 38363cbc..e0e1cccb 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2447,8 +2447,31 @@ impl State { }; if let Some((point, output)) = point_and_output { + // TODO: Replace with `wl_pointer.warp` let original_position = pointer.current_location(); - pointer.set_location(point.as_logical()); + let serial = SERIAL_COUNTER.next_serial(); + let under = State::surface_under(point, &output, &self.common.shell.write()) + .map(|(target, pos)| (target, pos.as_logical())); + let time = self.common.clock.now(); + pointer.relative_motion( + self, + under.clone(), + &RelativeMotionEvent { + delta: (0., 0.).into(), + delta_unaccel: (0., 0.).into(), + utime: time.as_micros(), + }, + ); + pointer.motion( + self, + under, + &MotionEvent { + location: point.as_logical(), + serial, + time: time.as_millis(), + }, + ); + pointer.frame(self); let mut shell = self.common.shell.write(); shell.update_pointer_position(point.to_local(&output), &output);