1
0
Fork 0
forked from wry/wry

autocommit 2022-04-10 18:26:13 CEST

This commit is contained in:
Julian Orth 2022-04-10 18:26:13 +02:00
parent af152f7f3e
commit 6b3316e920
26 changed files with 514 additions and 82 deletions

View file

@ -217,6 +217,16 @@ impl WlSeatGlobal {
pub fn set_position(&self, x: i32, y: i32) {
self.pos.set((Fixed::from_int(x), Fixed::from_int(y)));
self.trigger_tree_changed();
'set_output: {
let outputs = self.state.outputs.lock();
for output in outputs.values() {
if output.node.global.pos.get().contains(x, y) {
self.output.set(output.node.clone());
break 'set_output;
}
}
self.output.set(self.state.dummy_output.get().unwrap());
}
}
pub fn position(&self) -> (Fixed, Fixed) {

View file

@ -21,7 +21,7 @@ use {
wl_surface::{xdg_surface::xdg_popup::XdgPopup, WlSurface},
},
object::ObjectId,
tree::{FloatNode, Node, OutputNode, ToplevelNode},
tree::{FloatNode, Node, ToplevelNode},
utils::{clonecell::CloneCell, smallmap::SmallMap},
wire::WlDataOfferId,
xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP},
@ -172,6 +172,7 @@ impl WlSeatGlobal {
Some(o) => o,
_ => return,
};
self.output.set(output.node.clone());
let pos = output.node.global.pos.get();
x += Fixed::from_int(pos.x1());
y += Fixed::from_int(pos.y1());
@ -191,6 +192,7 @@ impl WlSeatGlobal {
let outputs = self.state.outputs.lock();
for output in outputs.values() {
if output.node.global.pos.get().contains(x_int, y_int) {
self.output.set(output.node.clone());
break 'warp;
}
}
@ -517,10 +519,6 @@ impl WlSeatGlobal {
// self.focus_xdg_surface(&n.xdg);
}
pub fn enter_output(self: &Rc<Self>, output: &Rc<OutputNode>) {
self.output.set(output.clone());
}
pub fn enter_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
let serial = self.serial.fetch_add(1);
self.surface_pointer_event(0, n, |p| p.send_enter(serial, n.id, x, y));

View file

@ -293,6 +293,7 @@ impl Node for XdgPopup {
}
fn set_visible(&self, visible: bool) {
log::info!("set visible = {}", visible);
self.xdg.set_visible(visible);
self.xdg.seat_state.set_visible(self, visible);
}
@ -362,11 +363,18 @@ impl XdgSurfaceExt for XdgPopup {
*wl = Some(ws.stacked.add_last(self.clone()));
*dl = Some(state.root.stacked.add_last(self.clone()));
state.tree_changed();
self.set_visible(
self.parent
.get()
.map(|p| p.surface.visible.get())
.unwrap_or(false),
);
}
} else {
if wl.take().is_some() {
drop(wl);
drop(dl);
self.set_visible(false);
self.destroy_node(true);
self.send_popup_done();
}

View file

@ -280,16 +280,7 @@ impl Xwindow {
self.data.state.tree_changed();
}
Change::Map if self.data.info.wants_floating.get() => {
let ws = match self.data.state.root.outputs.lock().values().cloned().next() {
Some(output) => output.ensure_workspace(),
_ => self
.data
.state
.dummy_output
.get()
.unwrap()
.ensure_workspace(),
};
let ws = self.data.state.float_map_ws();
let ext = self.data.info.extents.get();
self.data
.state