1
0
Fork 0
forked from wry/wry

autocommit 2022-02-14 21:47:35 CET

This commit is contained in:
Julian Orth 2022-02-14 21:47:35 +01:00
parent da6b29f138
commit 290225190a
11 changed files with 191 additions and 19 deletions

View file

@ -14,7 +14,7 @@ use std::fmt::{Debug, Formatter};
use std::mem;
use std::ops::DerefMut;
use std::rc::Rc;
use i4config::Direction;
use i4config::{Axis, Direction};
#[allow(dead_code)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
@ -23,6 +23,24 @@ pub enum ContainerSplit {
Vertical,
}
impl From<Axis> for ContainerSplit {
fn from(a: Axis) -> Self {
match a {
Axis::Horizontal => Self::Horizontal,
Axis::Vertical => Self::Vertical,
}
}
}
impl Into<Axis> for ContainerSplit {
fn into(self) -> Axis {
match self {
ContainerSplit::Horizontal => Axis::Horizontal,
ContainerSplit::Vertical => Axis::Vertical,
}
}
}
#[allow(dead_code)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum ContainerFocus {
@ -422,6 +440,16 @@ impl Node for ContainerNode {
self.seat_state.destroy_node(self);
}
fn get_split(&self) -> Option<ContainerSplit> {
Some(self.split.get())
}
fn set_split(&self, split: ContainerSplit) {
self.split.set(split);
self.update_content_size();
self.apply_factors(1.0);
}
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let node = match direction {
Direction::Left => self.children.last(),
@ -539,7 +567,6 @@ impl Node for ContainerNode {
};
return;
};
log::info!("op = {:?}", kind);
seat_data.op = Some(SeatOp { child, kind })
} else if state == KeyState::Released {
let op = seat_data.op.take().unwrap();

View file

@ -17,7 +17,7 @@ use std::cell::{Cell, RefCell};
use std::fmt::{Debug, Display, Formatter};
use std::ops::Deref;
use std::rc::Rc;
use i4config::Direction;
use i4config::{Direction};
pub use workspace::*;
mod container;
@ -67,6 +67,22 @@ pub trait Node {
fn seat_state(&self) -> &NodeSeatState;
fn destroy_node(&self, detach: bool);
fn get_parent_split(&self) -> Option<ContainerSplit> {
None
}
fn set_parent_split(&self, split: ContainerSplit) {
let _ = split;
}
fn get_split(&self) -> Option<ContainerSplit> {
None
}
fn set_split(&self, split: ContainerSplit) {
let _ = split;
}
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let _ = seat;
let _ = direction;