1
0
Fork 0
forked from wry/wry

autocommit 2022-02-01 01:20:49 CET

This commit is contained in:
Julian Orth 2022-02-01 01:20:49 +01:00
parent f2117256b9
commit 7654e70f64
39 changed files with 830 additions and 761 deletions

View file

@ -2,7 +2,9 @@ mod types;
pub mod xdg_popup;
pub mod xdg_toplevel;
use crate::backend::SeatId;
use crate::client::DynEventFormatter;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
use crate::ifs::wl_surface::xdg_surface::xdg_popup::{XdgPopup, XdgPopupId};
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
use crate::ifs::wl_surface::{
@ -15,13 +17,11 @@ use crate::tree::{FindTreeResult, FoundNode, Node, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::smallmap::SmallMap;
use crate::NumCell;
use std::cell::Cell;
use std::rc::Rc;
pub use types::*;
use crate::backend::SeatId;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
use crate::utils::smallmap::SmallMap;
const DESTROY: u32 = 0;
const GET_TOPLEVEL: u32 = 1;
@ -158,7 +158,9 @@ impl XdgSurface {
}
pub fn focus_surface(&self, seat: &WlSeatGlobal) -> Rc<WlSurface> {
self.focus_surface.get(&seat.id()).unwrap_or_else(|| self.surface.clone())
self.focus_surface
.get(&seat.id())
.unwrap_or_else(|| self.surface.clone())
}
fn destroy_node(&self) {
@ -318,16 +320,10 @@ impl XdgSurface {
}
match self.surface.find_surface_at(x, y) {
Some((node, x, y)) => {
tree.push(FoundNode {
node,
x,
y,
});
tree.push(FoundNode { node, x, y });
FindTreeResult::AcceptsInput
},
_ => {
FindTreeResult::Other
}
_ => FindTreeResult::Other,
}
}

View file

@ -1,7 +1,7 @@
use crate::client::{ClientError, EventFormatter, RequestParser};
use crate::ifs::wl_surface::xdg_surface::xdg_popup::{XdgPopupError, XdgPopupId};
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevelId;
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceId, CONFIGURE, XdgSurfaceRole};
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceId, XdgSurfaceRole, CONFIGURE};
use crate::ifs::wl_surface::{WlSurfaceError, WlSurfaceId};
use crate::ifs::xdg_positioner::XdgPositionerId;
use crate::object::Object;

View file

@ -268,7 +268,7 @@ impl XdgSurfaceExt for XdgPopup {
_ => {
log::info!("no ws");
return;
},
}
};
let surface = &self.xdg.surface;
let state = &surface.client.state;
@ -276,12 +276,7 @@ impl XdgSurfaceExt for XdgPopup {
if wl.is_none() {
self.xdg.set_workspace(&ws);
*wl = Some(ws.stacked.add_last(self.clone()));
*dl = Some(
state
.root
.stacked
.add_last(self.clone()),
);
*dl = Some(state.root.stacked.add_last(self.clone()));
state.tree_changed();
}
} else {

View file

@ -1,5 +1,6 @@
mod types;
use crate::backend::SeatId;
use crate::client::{ClientId, DynEventFormatter};
use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
@ -11,16 +12,15 @@ use crate::tree::{ContainerNode, FindTreeResult};
use crate::tree::{FloatNode, FoundNode, Node, NodeId, ToplevelNodeId, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::clonecell::CloneCell;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::smallmap::SmallMap;
use crate::NumCell;
use ahash::{AHashMap, AHashSet};
use num_derive::FromPrimitive;
use std::cell::{Cell, RefCell};
use std::mem;
use std::rc::Rc;
pub use types::*;
use crate::backend::{SeatId};
use crate::NumCell;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::smallmap::SmallMap;
const DESTROY: u32 = 0;
const SET_PARENT: u32 = 1;
@ -72,6 +72,13 @@ const STATE_TILED_BOTTOM: u32 = 8;
id!(XdgToplevelId);
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Decoration {
#[allow(dead_code)]
Client,
Server,
}
pub struct XdgToplevel {
pub id: XdgToplevelId,
pub xdg: Rc<XdgSurface>,
@ -82,6 +89,7 @@ pub struct XdgToplevel {
states: RefCell<AHashSet<u32>>,
pub toplevel_history: SmallMap<SeatId, LinkedNode<Rc<XdgToplevel>>, 1>,
active_surfaces: NumCell<u32>,
pub decoration: Cell<Decoration>,
}
impl XdgToplevel {
@ -101,6 +109,7 @@ impl XdgToplevel {
states: RefCell::new(states),
toplevel_history: Default::default(),
active_surfaces: Default::default(),
decoration: Cell::new(Decoration::Server),
}
}
@ -114,7 +123,10 @@ impl XdgToplevel {
};
if changed {
let rect = self.xdg.absolute_desired_extents.get();
self.xdg.surface.client.event(self.configure(rect.width(), rect.height()));
self.xdg
.surface
.client
.event(self.configure(rect.width(), rect.height()));
self.xdg.send_configure();
}
}
@ -282,17 +294,12 @@ impl XdgToplevel {
seat_state: Default::default(),
});
self.parent_node.set(Some(floater.clone()));
floater.display_link.set(Some(
state
.root
.stacked
.add_last(floater.clone()),
));
floater.workspace_link.set(Some(
workspace
.stacked
.add_last(floater.clone()),
));
floater
.display_link
.set(Some(state.root.stacked.add_last(floater.clone())));
floater
.workspace_link
.set(Some(workspace.stacked.add_last(floater.clone())));
}
fn map_tiled(self: &Rc<Self>) {
@ -319,8 +326,12 @@ impl XdgToplevel {
container.append_child(self.clone());
self.parent_node.set(Some(container));
} else {
let container =
Rc::new(ContainerNode::new(state, &workspace, workspace.clone(), self.clone()));
let container = Rc::new(ContainerNode::new(
state,
&workspace,
workspace.clone(),
self.clone(),
));
workspace.set_container(&container);
self.parent_node.set(Some(container));
};
@ -444,7 +455,10 @@ impl XdgSurfaceExt for XdgToplevel {
let bindings = output.global.bindings.borrow_mut();
for binding in bindings.get(&self.xdg.surface.client.id) {
for binding in binding.values() {
self.xdg.surface.client.event(self.xdg.surface.enter_event(binding.id));
self.xdg
.surface
.client
.event(self.xdg.surface.enter_event(binding.id));
}
}
}