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.
This commit is contained in:
Ian Douglas Scott 2026-07-13 19:35:14 -07:00 committed by Victoria Brekenfeld
parent c92c18e09e
commit dda2d14832

View file

@ -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);