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

@ -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,