1
0
Fork 0
forked from wry/wry

autocommit 2022-04-08 23:02:38 CEST

This commit is contained in:
Julian Orth 2022-04-08 23:02:38 +02:00
parent 0bd9a70e69
commit 21e2216ce5
40 changed files with 587 additions and 255 deletions

View file

@ -288,6 +288,15 @@ impl Node for XdgPopup {
visitor.visit_surface(&self.xdg.surface);
}
fn visible(&self) -> bool {
self.xdg.surface.visible.get()
}
fn set_visible(&self, visible: bool) {
self.xdg.surface.set_visible(visible);
self.xdg.seat_state.set_visible(self, visible);
}
fn get_workspace(&self) -> Option<Rc<WorkspaceNode>> {
self.xdg.workspace.get()
}

View file

@ -143,6 +143,12 @@ impl XdgToplevel {
self.send_configure(width, height)
}
fn send_close(&self) {
self.xdg.surface.client.event(Close {
self_id: self.id,
});
}
fn send_configure(&self, width: i32, height: i32) {
let states: Vec<_> = self.states.borrow().iter().copied().collect();
self.xdg.surface.client.event(Configure {
@ -384,6 +390,15 @@ impl Node for XdgToplevel {
visitor.visit_surface(&self.xdg.surface);
}
fn visible(&self) -> bool {
self.xdg.surface.visible.get()
}
fn set_visible(&self, visible: bool) {
self.xdg.surface.set_visible(visible);
self.xdg.seat_state.set_visible(self, visible);
}
fn get_workspace(&self) -> Option<Rc<WorkspaceNode>> {
self.xdg.workspace.get()
}
@ -508,6 +523,10 @@ impl ToplevelNode for XdgToplevel {
self.map_floating(&ws);
}
}
fn close(&self) {
self.send_close();
}
}
impl XdgSurfaceExt for XdgToplevel {
@ -546,12 +565,12 @@ impl XdgSurfaceExt for XdgToplevel {
}
}
}
{
let seats = surface.client.state.globals.lock_seats();
for seat in seats.values() {
seat.focus_toplevel(self.clone());
}
}
// {
// let seats = surface.client.state.globals.lock_seats();
// for seat in seats.values() {
// seat.focus_toplevel(self.clone());
// }
// }
surface.client.state.tree_changed();
}
}

View file

@ -1,4 +1,3 @@
use std::ops::Not;
use {
crate::{
client::Client,
@ -27,7 +26,7 @@ use {
jay_config::Direction,
std::{
cell::{Cell, RefCell},
ops::{Deref},
ops::{Deref, Not},
rc::Rc,
},
thiserror::Error,
@ -142,7 +141,6 @@ pub struct Xwindow {
pub events: Rc<AsyncQueue<XWaylandEvent>>,
pub workspace: CloneCell<Option<Rc<WorkspaceNode>>>,
pub display_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
pub display_xlink: RefCell<Option<LinkedNode<Rc<Xwindow>>>>,
pub toplevel_data: ToplevelData,
}
@ -219,7 +217,6 @@ impl Xwindow {
events: events.clone(),
workspace: Default::default(),
display_link: Default::default(),
display_xlink: Default::default(),
toplevel_data: Default::default(),
}
}
@ -279,8 +276,6 @@ impl Xwindow {
Change::Map if self.data.info.override_redirect.get() => {
*self.display_link.borrow_mut() =
Some(self.data.state.root.stacked.add_last(self.clone()));
*self.display_xlink.borrow_mut() =
Some(self.data.state.root.xstacked.add_last(self.clone()));
self.data.state.tree_changed();
}
Change::Map if self.data.info.wants_floating.get() => {
@ -334,13 +329,21 @@ impl Node for Xwindow {
self.id.into()
}
fn visible(&self) -> bool {
self.surface.visible.get()
}
fn set_visible(&self, visible: bool) {
self.surface.set_visible(visible);
self.seat_state.set_visible(self, visible);
}
fn seat_state(&self) -> &NodeSeatState {
&self.seat_state
}
fn destroy_node(&self, _detach: bool) {
self.toplevel_data.clear();
self.display_xlink.borrow_mut().take();
self.display_link.borrow_mut().take();
self.workspace.take();
self.focus_history.clear();
@ -449,7 +452,8 @@ impl ToplevelNode for Xwindow {
}
fn accepts_keyboard_focus(&self) -> bool {
self.data.info.never_focus.get().not() && self.data.info.input_model.get() != XInputModel::None
self.data.info.never_focus.get().not()
&& self.data.info.input_model.get() != XInputModel::None
}
fn default_surface(&self) -> Rc<WlSurface> {
@ -482,6 +486,10 @@ impl ToplevelNode for Xwindow {
.map_floating(self.clone(), extents.width(), extents.height(), &ws);
}
}
fn close(&self) {
self.events.push(XWaylandEvent::Close(self.data.clone()));
}
}
#[derive(Debug, Error)]

View file

@ -370,6 +370,10 @@ impl Node for ZwlrLayerSurfaceV1 {
self.surface.clone().visit(visitor);
}
fn visible(&self) -> bool {
true
}
fn absolute_position(&self) -> Rect {
self.pos.get()
}