1
0
Fork 0
forked from wry/wry

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

This commit is contained in:
Julian Orth 2022-02-02 20:01:25 +01:00
parent 65a7a55b82
commit 89b8396932
12 changed files with 279 additions and 57 deletions

View file

@ -8,7 +8,7 @@ use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA};
use crate::object::{Interface, Object, ObjectId};
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::{AbsoluteNode, FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::clonecell::CloneCell;
use crate::utils::linkedlist::LinkedNode;
@ -37,8 +37,8 @@ pub struct XdgPopup {
pub xdg: Rc<XdgSurface>,
pub(super) parent: CloneCell<Option<Rc<XdgSurface>>>,
relative_position: Cell<Rect>,
display_link: RefCell<Option<LinkedNode<Rc<dyn AbsoluteNode>>>>,
workspace_link: RefCell<Option<LinkedNode<Rc<dyn AbsoluteNode>>>>,
display_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
workspace_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
pos: RefCell<XdgPositioned>,
}
@ -268,16 +268,6 @@ impl Object for XdgPopup {
}
}
impl AbsoluteNode for XdgPopup {
fn into_node(self: Rc<Self>) -> Rc<dyn Node> {
self
}
fn absolute_position(&self) -> (Rect, bool) {
(self.xdg.absolute_desired_extents.get(), false)
}
}
impl Node for XdgPopup {
fn id(&self) -> NodeId {
self.node_id.into()
@ -294,6 +284,14 @@ impl Node for XdgPopup {
self.xdg.seat_state.destroy_node(self);
}
fn absolute_position(&self) -> Rect {
self.xdg.absolute_desired_extents.get()
}
fn absolute_position_constrains_input(&self) -> bool {
false
}
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
self.xdg.find_tree_at(x, y, tree)
}

View file

@ -1,6 +1,6 @@
mod types;
use crate::backend::SeatId;
use crate::backend::{SeatId};
use crate::client::{ClientId, DynEventFormatter};
use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
@ -388,6 +388,10 @@ impl Node for XdgToplevel {
self.xdg.seat_state.destroy_node(self)
}
fn absolute_position(&self) -> Rect {
self.xdg.absolute_desired_extents.get()
}
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
self.xdg.find_tree_at(x, y, tree)
}
@ -405,12 +409,14 @@ impl Node for XdgToplevel {
}
fn change_extents(self: Rc<Self>, rect: &Rect) {
let nw = rect.width();
let nh = rect.height();
let de = self.xdg.absolute_desired_extents.replace(*rect);
if de.width() != rect.width() || de.height() != rect.height() {
if de.width() != nw || de.height() != nh {
self.xdg
.surface
.client
.event(self.configure(rect.width(), rect.height()));
.event(self.configure(nw.max(1), nh.max(1)));
self.xdg.send_configure();
self.xdg.surface.client.flush();
}