1
0
Fork 0
forked from wry/wry

autocommit 2022-02-15 22:53:12 CET

This commit is contained in:
Julian Orth 2022-02-15 22:53:12 +01:00
parent 290225190a
commit cacd49d15a
33 changed files with 884 additions and 220 deletions

View file

@ -1,7 +1,7 @@
use crate::backend::{KeyState};
use crate::backend::KeyState;
use crate::cursor::KnownCursor;
use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal, BTN_LEFT, SeatId};
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT};
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
@ -9,12 +9,12 @@ use crate::utils::clonecell::CloneCell;
use crate::utils::linkedlist::{LinkedList, LinkedNode, NodeRef};
use crate::{NumCell, State};
use ahash::AHashMap;
use i4config::{Axis, Direction};
use std::cell::{Cell, RefCell};
use std::fmt::{Debug, Formatter};
use std::mem;
use std::ops::DerefMut;
use std::rc::Rc;
use i4config::{Axis, Direction};
#[allow(dead_code)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
@ -462,7 +462,12 @@ impl Node for ContainerNode {
}
}
fn move_focus_from_child(&self, seat: &Rc<WlSeatGlobal>, child: &dyn Node, direction: Direction) {
fn move_focus_from_child(
&self,
seat: &Rc<WlSeatGlobal>,
child: &dyn Node,
direction: Direction,
) {
let children = self.child_nodes.borrow_mut();
let child = match children.get(&child.id()) {
Some(c) => c,
@ -473,7 +478,9 @@ impl Node for ContainerNode {
ContainerSplit::Vertical => matches!(direction, Direction::Up | Direction::Down),
};
if !in_line {
self.parent.get().move_focus_from_child(seat, self, direction);
self.parent
.get()
.move_focus_from_child(seat, self, direction);
return;
}
let prev = match direction {
@ -484,12 +491,14 @@ impl Node for ContainerNode {
};
let sibling = match prev {
true => child.prev(),
false => child.next()
false => child.next(),
};
let sibling = match sibling {
Some(s) => s,
None => {
self.parent.get().move_focus_from_child(seat, self, direction);
self.parent
.get()
.move_focus_from_child(seat, self, direction);
return;
}
};

View file

@ -13,11 +13,11 @@ use crate::utils::linkedlist::{LinkedList, LinkedNode};
use crate::xkbcommon::ModifierState;
use crate::NumCell;
pub use container::*;
use i4config::Direction;
use std::cell::{Cell, RefCell};
use std::fmt::{Debug, Display, Formatter};
use std::ops::Deref;
use std::rc::Rc;
use i4config::{Direction};
pub use workspace::*;
mod container;
@ -93,7 +93,12 @@ pub trait Node {
let _ = direction;
}
fn move_focus_from_child(&self, seat: &Rc<WlSeatGlobal>, child: &dyn Node, direction: Direction) {
fn move_focus_from_child(
&self,
seat: &Rc<WlSeatGlobal>,
child: &dyn Node,
direction: Direction,
) {
let _ = seat;
let _ = direction;
let _ = child;