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

@ -22,7 +22,7 @@ use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
use crate::ifs::wl_surface::WlSurface;
use crate::leaks::Tracker;
use crate::object::{Object, ObjectId};
use crate::tree::{FloatNode, FoundNode, Node};
use crate::tree::{ContainerSplit, FloatNode, FoundNode, Node};
use crate::utils::asyncevent::AsyncEvent;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
@ -45,7 +45,7 @@ use std::ops::DerefMut;
use std::rc::Rc;
use thiserror::Error;
use uapi::{c, Errno, OwnedFd};
use i4config::Direction;
use i4config::{ Direction};
use crate::async_engine::SpawnedFuture;
const POINTER: u32 = 1;
@ -190,6 +190,14 @@ impl WlSeatGlobal {
}
}
pub fn get_split(&self) -> Option<ContainerSplit> {
self.keyboard_node.get().get_parent_split()
}
pub fn set_split(&self, axis: ContainerSplit) {
self.keyboard_node.get().set_parent_split(axis)
}
pub fn get_rate(&self) -> (i32, i32) {
self.repeat_rate.get()
}

View file

@ -15,7 +15,7 @@ use crate::object::Object;
use crate::pixman::Region;
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::{Node, NodeId};
use crate::tree::{ContainerSplit, Node, NodeId};
use crate::utils::buffd::{MsgParser, MsgParserError};
use crate::utils::clonecell::CloneCell;
use crate::utils::linkedlist::LinkedList;
@ -31,7 +31,7 @@ use std::mem;
use std::ops::{Deref, DerefMut};
use std::rc::Rc;
use thiserror::Error;
use i4config::Direction;
use i4config::{ Direction};
use crate::backend::{KeyState, ScrollAxis};
#[allow(dead_code)]
@ -610,6 +610,14 @@ impl Node for WlSurface {
self.seat_state.destroy_node(self);
}
fn get_parent_split(&self) -> Option<ContainerSplit> {
self.xdg.get().and_then(|x| x.get_split())
}
fn set_parent_split(&self, split: ContainerSplit) {
self.xdg.get().map(|x| x.set_split(split));
}
fn move_focus(&self, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let xdg = match self.xdg.get() {
Some(x) => x,

View file

@ -12,7 +12,7 @@ use crate::ifs::xdg_wm_base::XdgWmBase;
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::tree::{FindTreeResult, FoundNode, Node, WorkspaceNode};
use crate::tree::{ContainerSplit, FindTreeResult, FoundNode, Node, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::clonecell::CloneCell;
@ -25,7 +25,7 @@ use std::cell::Cell;
use std::fmt::Debug;
use std::rc::Rc;
use thiserror::Error;
use i4config::Direction;
use i4config::{Direction};
#[allow(dead_code)]
const NOT_CONSTRUCTED: u32 = 1;
@ -75,6 +75,14 @@ struct PendingXdgSurfaceData {
}
pub trait XdgSurfaceExt: Debug {
fn get_split(&self) -> Option<ContainerSplit> {
None
}
fn set_split(&self, split: ContainerSplit) {
let _ = split;
}
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let _ = seat;
let _ = direction;
@ -142,6 +150,14 @@ impl XdgSurface {
}
}
pub fn get_split(&self) -> Option<ContainerSplit> {
self.ext.get().and_then(|e| e.get_split())
}
pub fn set_split(&self, split: ContainerSplit) {
self.ext.get().map(|e| e.set_split(split));
}
pub fn move_focus(&self, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let ext = match self.ext.get() {
None => return,

View file

@ -8,7 +8,7 @@ use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::{ContainerNode, FindTreeResult};
use crate::tree::{ContainerNode, ContainerSplit, FindTreeResult};
use crate::tree::{FloatNode, FoundNode, Node, NodeId, ToplevelNodeId, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
@ -26,7 +26,7 @@ use std::mem;
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
use i4config::Direction;
use i4config::{Direction};
#[derive(Copy, Clone, Debug, FromPrimitive)]
pub enum ResizeEdge {
@ -484,6 +484,14 @@ impl Node for XdgToplevel {
}
impl XdgSurfaceExt for XdgToplevel {
fn get_split(&self) -> Option<ContainerSplit> {
self.parent_node.get().and_then(|p| p.get_split())
}
fn set_split(&self, split: ContainerSplit) {
self.parent_node.get().map(|p| p.set_split(split));
}
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let pn = match self.parent_node.get() {
Some(pn) => pn,