1
0
Fork 0
forked from wry/wry

autocommit 2022-02-02 01:20:49 CET

This commit is contained in:
Julian Orth 2022-02-02 01:20:49 +01:00
parent 2dbe3ba732
commit 65a7a55b82
8 changed files with 105 additions and 17 deletions

View file

@ -339,16 +339,27 @@ impl WlSeatGlobal {
}
}
} else {
if let Some(last) = stack.last() {
last.pointer_untarget(self);
}
for old in stack.drain(divergence..).rev() {
old.leave(self);
old.seat_state().leave(self);
}
for new in found_tree.drain(divergence..) {
new.node.seat_state().enter(self);
new.node
.clone()
.enter(self, x.apply_fract(new.x), y.apply_fract(new.y));
stack.push(new.node);
if found_tree.len() == divergence {
if let Some(node) = found_tree.last() {
node.node
.clone()
.motion(self, x.apply_fract(node.x), y.apply_fract(node.y));
}
} else {
for new in found_tree.drain(divergence..) {
new.node.seat_state().enter(self);
new.node
.clone()
.enter(self, x.apply_fract(new.x), y.apply_fract(new.y));
stack.push(new.node);
}
}
if let Some(node) = stack.last() {
node.pointer_target(self);

View file

@ -131,6 +131,8 @@ impl WlSeatGlobal {
};
let tpl = match cursor {
KnownCursor::Default => &cursors.default,
KnownCursor::ResizeLeftRight => &cursors.resize_left_right,
KnownCursor::ResizeTopBottom => &cursors.resize_top_bottom,
};
self.set_cursor(Some(tpl.instantiate()));
}
@ -145,7 +147,6 @@ impl WlSeatGlobal {
old.handle_unset();
}
if let Some(cursor) = cursor.as_ref() {
log::info!("setting new cursor");
let (x, y) = self.pos.get();
cursor.set_position(x.round_down(), y.round_down());
}

View file

@ -632,7 +632,7 @@ impl Node for WlSurface {
seat.enter_surface(&self, x, y)
}
fn motion(&self, seat: &WlSeatGlobal, x: Fixed, y: Fixed) {
fn motion(&self, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
seat.motion_surface(self, x, y)
}