pointer-constraints: defer cursor position update
This commit is contained in:
parent
0930f00356
commit
00aa689e7a
5 changed files with 20 additions and 15 deletions
|
|
@ -516,23 +516,23 @@ impl WlSeatGlobal {
|
|||
let pos = output.global.pos.get();
|
||||
x += Fixed::from_int(pos.x1());
|
||||
y += Fixed::from_int(pos.y1());
|
||||
self.motion_event_abs(time_usec, x, y);
|
||||
self.motion_event_abs(time_usec, x, y, false);
|
||||
}
|
||||
|
||||
pub fn motion_event_abs(self: &Rc<Self>, time_usec: u64, x: Fixed, y: Fixed) {
|
||||
pub fn motion_event_abs(self: &Rc<Self>, time_usec: u64, x: Fixed, y: Fixed, defer: bool) {
|
||||
self.for_each_ei_seat(|ei_seat| {
|
||||
ei_seat.handle_motion_abs(time_usec, x, y);
|
||||
});
|
||||
let (x, y) = self.set_pointer_cursor_position(x, y);
|
||||
if let Some(c) = self.constraint.get() {
|
||||
if c.ty == ConstraintType::Lock || !c.contains(x.round_down(), y.round_down()) {
|
||||
c.deactivate(false);
|
||||
c.deactivate(false, false);
|
||||
}
|
||||
}
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_pointer_abs(self.id, time_usec, x, y);
|
||||
});
|
||||
self.cursor_moved(time_usec);
|
||||
self.cursor_moved(time_usec, defer);
|
||||
}
|
||||
|
||||
pub fn motion_event(
|
||||
|
|
@ -587,7 +587,7 @@ impl WlSeatGlobal {
|
|||
);
|
||||
});
|
||||
self.set_pointer_cursor_position(x, y);
|
||||
self.cursor_moved(time_usec);
|
||||
self.cursor_moved(time_usec, false);
|
||||
}
|
||||
|
||||
pub fn button_event(self: &Rc<Self>, time_usec: u64, button: u32, state: KeyState) {
|
||||
|
|
@ -1095,10 +1095,14 @@ impl WlSeatGlobal {
|
|||
});
|
||||
}
|
||||
|
||||
fn cursor_moved(self: &Rc<Self>, time_usec: u64) {
|
||||
fn cursor_moved(self: &Rc<Self>, time_usec: u64, defer: bool) {
|
||||
self.pos_time_usec.set(time_usec);
|
||||
self.changes.or_assign(CHANGE_CURSOR_MOVED);
|
||||
self.apply_changes();
|
||||
if defer {
|
||||
self.trigger_tree_changed(false);
|
||||
} else {
|
||||
self.apply_changes();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn emulate_cursor_moved(&self) {
|
||||
|
|
@ -1285,7 +1289,7 @@ impl WlSeatGlobal {
|
|||
pub fn leave_surface(&self, n: &WlSurface) {
|
||||
let serial = n.client.next_serial();
|
||||
for (_, constraint) in &n.constraints {
|
||||
constraint.deactivate(true);
|
||||
constraint.deactivate(true, true);
|
||||
}
|
||||
self.surface_pointer_event(Version::ALL, n, |p| p.send_leave(serial, n.id));
|
||||
self.surface_pointer_frame(n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue