1
0
Fork 0
forked from wry/wry

toplevel-drag: correctly update surface positions

This commit is contained in:
Julian Orth 2024-07-10 20:03:20 +02:00
parent ac5a5ca949
commit ac8b22f2bb
2 changed files with 29 additions and 2 deletions

View file

@ -410,6 +410,16 @@ impl WlSeatGlobal {
}
}
fn set_pointer_cursor_position(&self, x: Fixed, y: Fixed) -> (Fixed, Fixed) {
let (x, y) = self.pointer_cursor.set_position(x, y);
if let Some(td) = self.pointer_owner.toplevel_drag() {
let x_int = x.round_down();
let y_int = y.round_down();
td.move_(x_int, y_int);
}
(x, y)
}
fn connector_position_event(
self: &Rc<Self>,
time_usec: u64,
@ -424,7 +434,7 @@ impl WlSeatGlobal {
let pos = output.global.pos.get();
x += Fixed::from_int(pos.x1());
y += Fixed::from_int(pos.y1());
(x, y) = self.pointer_cursor.set_position(x, y);
(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();
@ -484,7 +494,7 @@ impl WlSeatGlobal {
dy_unaccelerated,
);
});
self.pointer_cursor.set_position(x, y);
self.set_pointer_cursor_position(x, y);
self.cursor_moved(time_usec);
}