1
0
Fork 0
forked from wry/wry

autocommit 2022-04-07 23:21:31 CEST

This commit is contained in:
Julian Orth 2022-04-07 23:21:32 +02:00
parent be32036824
commit 26f8c1aeb6
14 changed files with 86 additions and 28 deletions

View file

@ -79,18 +79,8 @@ impl Node for DisplayNode {
x,
y,
});
let len = tree.len();
for layer in [OVERLAY, TOP] {
for surface in output.layers[layer as usize].rev_iter() {
let pos = surface.absolute_position();
if pos.contains(x, y) {
let (x, y) = pos.translate(x, y);
if surface.find_tree_at(x, y, tree) == FindTreeResult::AcceptsInput {
return FindTreeResult::AcceptsInput;
}
tree.truncate(len);
}
}
if output.find_layer_surface_at(x, y, &[OVERLAY, TOP], tree) == FindTreeResult::AcceptsInput {
return FindTreeResult::AcceptsInput;
}
tree.pop();
break;

View file

@ -23,6 +23,7 @@ use {
rc::Rc,
},
};
use crate::ifs::zwlr_layer_shell_v1::{BACKGROUND, BOTTOM};
tree_id!(OutputNodeId);
pub struct OutputNode {
@ -163,6 +164,23 @@ impl OutputNode {
}
self.global.send_mode();
}
pub fn find_layer_surface_at(&self, x: i32, y: i32, layers: &[u32], tree: &mut Vec<FoundNode>) -> FindTreeResult {
let len = tree.len();
for layer in layers.iter().copied() {
for surface in self.layers[layer as usize].rev_iter() {
let pos = surface.absolute_position();
if pos.contains(x, y) {
let (x, y) = pos.translate(x, y);
if surface.find_tree_at(x, y, tree) == FindTreeResult::AcceptsInput {
return FindTreeResult::AcceptsInput;
}
tree.truncate(len);
}
}
}
FindTreeResult::Other
}
}
pub struct OutputTitle {
@ -228,6 +246,7 @@ impl Node for OutputNode {
let th = self.state.theme.title_height.get();
if y > th {
y -= th;
let len = tree.len();
if let Some(ws) = self.workspace.get() {
tree.push(FoundNode {
node: ws.clone(),
@ -236,6 +255,9 @@ impl Node for OutputNode {
});
ws.find_tree_at(x, y, tree);
}
if tree.len() == len {
self.find_layer_surface_at(x, y, &[BOTTOM, BACKGROUND], tree);
}
}
FindTreeResult::AcceptsInput
}