1
0
Fork 0
forked from wry/wry

autocommit 2022-02-17 19:12:52 CET

This commit is contained in:
Julian Orth 2022-02-17 19:12:52 +01:00
parent cf322f05be
commit 195a92d98b
29 changed files with 610 additions and 175 deletions

View file

@ -195,6 +195,10 @@ impl WlSeatGlobal {
self.keyboard_node.get().set_parent_split(axis)
}
pub fn create_split(&self, axis: ContainerSplit) {
self.keyboard_node.get().create_split(axis)
}
pub fn get_rate(&self) -> (i32, i32) {
self.repeat_rate.get()
}

View file

@ -147,7 +147,7 @@ impl PointerOwner for DefaultPointerOwner {
}
if (stack.len(), found_tree.len()) == (divergence, divergence) {
if let Some(node) = found_tree.last() {
node.node
node.node.clone()
.motion(seat, x.apply_fract(node.x), y.apply_fract(node.y));
}
} else {
@ -242,7 +242,7 @@ impl PointerOwner for GrabPointerOwner {
let (x, y) = seat.pos.get();
let pos = self.node.absolute_position();
let (x_int, y_int) = pos.translate(x.round_down(), y.round_down());
self.node
self.node.clone()
.motion(seat, x.apply_fract(x_int), y.apply_fract(y_int));
}

View file

@ -618,6 +618,10 @@ impl Node for WlSurface {
self.xdg.get().map(|x| x.set_split(split));
}
fn create_split(self: Rc<Self>, split: ContainerSplit) {
self.xdg.get().map(|x| x.create_split(split));
}
fn move_focus(&self, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let xdg = match self.xdg.get() {
Some(x) => x,
@ -670,8 +674,8 @@ impl Node for WlSurface {
seat.enter_surface(&self, x, y)
}
fn motion(&self, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
seat.motion_surface(self, x, y)
fn motion(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
seat.motion_surface(&*self, x, y)
}
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {

View file

@ -83,6 +83,10 @@ pub trait XdgSurfaceExt: Debug {
let _ = split;
}
fn create_split(self: Rc<Self>, split: ContainerSplit) {
let _ = split;
}
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let _ = seat;
let _ = direction;
@ -158,6 +162,10 @@ impl XdgSurface {
self.ext.get().map(|e| e.set_split(split));
}
pub fn create_split(&self, split: ContainerSplit) {
self.ext.get().map(|e| e.create_split(split));
}
pub fn move_focus(&self, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let ext = match self.ext.get() {
None => return,

View file

@ -373,6 +373,7 @@ impl XdgToplevel {
&workspace,
workspace.clone(),
self.clone(),
ContainerSplit::Horizontal,
));
workspace.set_container(&container);
self.parent_node.set(Some(container));
@ -492,6 +493,26 @@ impl XdgSurfaceExt for XdgToplevel {
self.parent_node.get().map(|p| p.set_split(split));
}
fn create_split(self: Rc<Self>, split: ContainerSplit) {
let ws = match self.xdg.workspace.get() {
Some(ws) => ws,
_ => return,
};
let pn = match self.parent_node.get() {
Some(pn) => pn,
_ => return,
};
let cn = Rc::new(ContainerNode::new(
&self.xdg.surface.client.state,
&ws,
pn.clone(),
self.clone(),
split,
));
self.parent_node.set(Some(cn.clone()));
pn.replace_child(&*self, cn);
}
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let pn = match self.parent_node.get() {
Some(pn) => pn,