1
0
Fork 0
forked from wry/wry

pointer-constraints: defer cursor position update

This commit is contained in:
Julian Orth 2025-05-29 00:01:31 +02:00
parent 0930f00356
commit 00aa689e7a
5 changed files with 20 additions and 15 deletions

View file

@ -65,10 +65,10 @@ pub struct SeatConstraint {
}
impl SeatConstraint {
pub fn deactivate(&self, apply_position_hint: bool) {
pub fn deactivate(&self, apply_position_hint: bool, defer: bool) {
if self.status.get() == SeatConstraintStatus::Active {
self.seat.constraint.take();
self.handle_position_hint(apply_position_hint);
self.handle_position_hint(apply_position_hint, defer);
if let Some(owner) = self.owner.get() {
owner.send_disabled();
}
@ -80,7 +80,7 @@ impl SeatConstraint {
}
}
fn handle_position_hint(&self, apply: bool) {
fn handle_position_hint(&self, apply: bool, defer: bool) {
let Some((x, y)) = self.position_hint.take() else {
return;
};
@ -96,6 +96,7 @@ impl SeatConstraint {
self.client.state.now_usec(),
x.apply_fract(x_int),
y.apply_fract(y_int),
defer,
);
}
@ -140,7 +141,7 @@ impl SeatConstraint {
}
fn detach(&self) {
self.deactivate(true);
self.deactivate(true, false);
self.owner.take();
self.surface.constraints.remove(&self.seat.id);
}