1
0
Fork 0
forked from wry/wry

input: don't send motion events when cursor is locked

This commit is contained in:
Julian Orth 2022-07-22 13:11:57 +02:00
parent 0e5b1b5e35
commit 5de4f0962f

View file

@ -624,8 +624,15 @@ impl WlSeatGlobal {
// Motion callbacks
impl WlSeatGlobal {
pub fn motion_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
let time = (self.pos_time_usec.get() / 1000) as u32;
self.surface_pointer_event(0, n, |p| p.send_motion(time, x, y));
'send_motion: {
if let Some(constraint) = self.constraint.get() {
if constraint.ty == ConstraintType::Lock {
break 'send_motion;
}
}
let time = (self.pos_time_usec.get() / 1000) as u32;
self.surface_pointer_event(0, n, |p| p.send_motion(time, x, y));
}
self.surface_pointer_frame(n);
self.maybe_constrain(n, x, y);
}