From 921ed632041e3f6e3e3a6be26fcafd301c845004 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 6 Jul 2024 18:17:48 +0400 Subject: Add LayerSurface to PointerFocus --- src/niri.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/niri.rs b/src/niri.rs index 2ff2f014..03d3662f 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -367,6 +367,8 @@ pub struct PointerFocus { pub surface: Option<(WlSurface, Point)>, // If surface belongs to a window, this is that window. pub window: Option, + // If surface belongs to a layer surface, this is that layer surface. + pub layer: Option, } #[derive(Default)] @@ -2143,10 +2145,13 @@ impl Niri { WindowSurfaceType::ALL, ) .map(|(surface, pos_within_layer)| { - (surface, pos_within_layer.to_f64() + layer_pos_within_output) + ( + (surface, pos_within_layer.to_f64() + layer_pos_within_output), + layer, + ) }) }) - .map(|s| (s, None)) + .map(|(s, l)| (s, (None, Some(l.clone())))) }; let window_under = || { @@ -2163,7 +2168,7 @@ impl Niri { .map(|(s, pos_within_window)| { (s, pos_within_window.to_f64() + win_pos_within_output) }) - .map(|s| (s, Some(window.clone()))) + .map(|s| (s, (Some(window.clone()), None))) }) }; @@ -2181,7 +2186,7 @@ impl Niri { .or_else(window_under); } - let Some(((surface, surface_pos_within_output), window)) = under + let Some(((surface, surface_pos_within_output), (window, layer))) = under .or_else(|| layer_surface_under(Layer::Bottom)) .or_else(|| layer_surface_under(Layer::Background)) else { @@ -2193,6 +2198,7 @@ impl Niri { rv.surface = Some((surface, surface_loc_in_global_space)); rv.window = window; + rv.layer = layer; rv } -- cgit