Send relative_pointer in frame with pointer; update Smithay

The protocol doesn't specify this, but XWayland does assume relative
pointer events are part of a frame.

This works for now, though a better solution will be needed in Smithay
to also handle pointer constraints where a relative motion may occur
alone, etc.

This seems to fix https://github.com/pop-os/cosmic-comp/issues/159.
This commit is contained in:
Ian Douglas Scott 2023-09-08 11:10:53 -07:00
parent f6ea7fa81d
commit 6247918cad
3 changed files with 14 additions and 12 deletions

View file

@ -498,24 +498,26 @@ impl State {
}
}
let ptr = seat.get_pointer().unwrap();
ptr.motion(
self,
under.clone(),
&MotionEvent {
location: position,
serial,
time: event.time_msec(),
},
);
// Relative motion is sent first to ensure they're part of a `frame`
// TODO: Find more correct solution
ptr.relative_motion(
self,
under,
under.clone(),
&RelativeMotionEvent {
delta: event.delta(),
delta_unaccel: event.delta_unaccel(),
utime: event.time(),
},
);
ptr.motion(
self,
under,
&MotionEvent {
location: position,
serial,
time: event.time_msec(),
},
);
#[cfg(feature = "debug")]
if self.common.seats().position(|x| x == &seat).unwrap() == 0 {
let location = if let Some(output) = self.common.shell.outputs.first() {