diff --git a/Cargo.lock b/Cargo.lock index 9e8cc0ab..1fadfd50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4443,7 +4443,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay//smithay?rev=c17297b#c17297b68e8bc761ebddf6900926d78b19a5d8d1" +source = "git+https://github.com/pop-os/smithay?branch=fix-iteration#e079f6e29df916a5e76ccbff8dad1c4d84bcbe6d" dependencies = [ "appendlist", "ash", diff --git a/Cargo.toml b/Cargo.toml index 0a020d7f..35a7bfbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,4 +108,4 @@ inherits = "release" lto = "fat" [patch."https://github.com/Smithay/smithay.git"] -smithay = {git = "https://github.com/smithay//smithay", rev = "c17297b"} +smithay = {git = "https://github.com/pop-os/smithay", branch = "fix-iteration"} diff --git a/src/shell/element/mod.rs b/src/shell/element/mod.rs index 8b990f00..fdd6e627 100644 --- a/src/shell/element/mod.rs +++ b/src/shell/element/mod.rs @@ -816,6 +816,16 @@ impl CosmicMapped { CosmicMappedInternal::_GenericCatcher(_) => {} } } + + pub fn is_in_popup_input_region(&self, point: &Point) -> bool { + match &self.element { + CosmicMappedInternal::Window(w) => w.is_in_popup_input_region(point), + CosmicMappedInternal::Stack(s) => s.is_in_popup_input_region(point), + CosmicMappedInternal::_GenericCatcher(_) => { + unreachable!() + } + } + } } impl IsAlive for CosmicMapped { diff --git a/src/shell/element/stack.rs b/src/shell/element/stack.rs index 9a884c06..ece42972 100644 --- a/src/shell/element/stack.rs +++ b/src/shell/element/stack.rs @@ -605,6 +605,14 @@ impl CosmicStack { pub(crate) fn force_redraw(&self) { self.0.force_redraw(); } + + pub fn is_in_popup_input_region(&self, point: &Point) -> bool { + self.0.with_program(|p| { + let active = p.active.load(Ordering::SeqCst); + let windows = p.windows.lock().unwrap(); + windows[active].is_in_popup_input_region(point) + }) + } } #[derive(Debug, Clone, Copy)] diff --git a/src/shell/element/surface.rs b/src/shell/element/surface.rs index aa9452a8..1f2be01a 100644 --- a/src/shell/element/surface.rs +++ b/src/shell/element/surface.rs @@ -14,7 +14,8 @@ use smithay::{ ImportAll, Renderer, }, desktop::{ - space::SpaceElement, utils::OutputPresentationFeedback, PopupManager, Window, WindowSurface, + space::SpaceElement, utils::OutputPresentationFeedback, PopupManager, Window, + WindowSurface, WindowSurfaceType, }, input::{ keyboard::{KeyboardTarget, KeysymHandle, ModifiersState}, @@ -37,7 +38,7 @@ use smithay::{ }, wayland_server::protocol::wl_surface::WlSurface, }, - utils::{user_data::UserDataMap, IsAlive, Logical, Rectangle, Serial, Size}, + utils::{user_data::UserDataMap, IsAlive, Logical, Point, Rectangle, Serial, Size}, wayland::{ compositor::{with_states, SurfaceData}, seat::WaylandFocus, @@ -597,6 +598,15 @@ impl CosmicSurface { pub fn x11_surface(&self) -> Option<&X11Surface> { self.0.x11_surface() } + + pub fn is_in_popup_input_region(&self, point: &Point) -> bool { + self.0 + .surface_under( + *point, + WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE, + ) + .is_some() + } } impl IsAlive for CosmicSurface { diff --git a/src/shell/element/window.rs b/src/shell/element/window.rs index 46915f68..11dff37d 100644 --- a/src/shell/element/window.rs +++ b/src/shell/element/window.rs @@ -249,6 +249,11 @@ impl CosmicWindow { pub(crate) fn force_redraw(&self) { self.0.force_redraw(); } + + pub fn is_in_popup_input_region(&self, point: &Point) -> bool { + self.0 + .with_program(|p| p.window.is_in_popup_input_region(point)) + } } #[derive(Debug, Clone, Copy)] diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index af3361ca..2351353f 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -3113,11 +3113,9 @@ impl TilingLayout { } if matches!(overview, OverviewMode::None) { + // first check popups for (mapped, geo) in self.mapped() { - if !mapped.bbox().contains((location - geo.loc).as_logical()) { - continue; - } - if mapped.is_in_input_region( + if mapped.is_in_popup_input_region( &((location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64()), ) {