1
0
Fork 0
forked from wry/wry

autocommit 2022-02-20 22:56:26 CET

This commit is contained in:
Julian Orth 2022-02-20 22:56:26 +01:00
parent a8505be462
commit 7fecc0d1a4
5 changed files with 39 additions and 15 deletions

View file

@ -189,9 +189,10 @@ impl WlSeatGlobal {
self.pointer_stack.borrow().last().cloned()
}
pub fn last_tiled_keyboard_toplevel(&self) -> Option<Rc<XdgToplevel>> {
pub fn last_tiled_keyboard_toplevel(&self, new: &dyn Node) -> Option<Rc<XdgToplevel>> {
let is_container = new.is_container();
for tl in self.toplevel_focus_history.rev_iter() {
if !tl.parent_is_float() {
if !tl.parent_is_float() && (!is_container || !tl.is_contained_in(new.id())) {
return Some(tl.deref().clone());
}
}

View file

@ -417,6 +417,16 @@ impl Node for XdgToplevel {
visitor.visit_surface(&self.xdg.surface);
}
fn is_contained_in(&self, other: NodeId) -> bool {
if let Some(parent) = self.parent_node.get() {
if parent.id() == other {
return true;
}
return parent.is_contained_in(other);
}
false
}
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
seat.focus_toplevel(&self);
}