Skip to content

Commit 4bac324

Browse files
committed
In keyboard_leave, ignore event for unrecognized wl_surface
Do nothing here if the surface belongs to a different panel.
1 parent 0b14e81 commit 4bac324

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

cosmic-panel-bin/src/space/wrapper_space.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,16 +1393,28 @@ impl WrapperSpace for PanelSpace {
13931393
}
13941394

13951395
fn keyboard_leave(&mut self, seat_name: &str, f: Option<c_wl_surface::WlSurface>) {
1396-
// if not a leaf, return early
13971396
if let Some(surface) = f.as_ref() {
1397+
// if not a leaf, return early
13981398
if self.popups.iter().any(|p| p.popup.parent == *surface) {
13991399
return;
14001400
}
1401-
}
1402-
if self.layer.as_ref().zip(f).is_some_and(|l| l.0.wl_surface() == &l.1)
1403-
&& (self.popups.iter().any(|p| p.popup.grab) || self.overflow_popup.is_some())
1404-
{
1405-
return;
1401+
1402+
if self.layer.as_ref().is_some_and(|l| l.wl_surface() == surface)
1403+
&& (self.popups.iter().any(|p| p.popup.grab) || self.overflow_popup.is_some())
1404+
{
1405+
return;
1406+
}
1407+
1408+
// Ignore event for wl_surface that isn't our layer or popup (i.e. a different panel)
1409+
if !self.layer.as_ref().is_some_and(|l| l.wl_surface() == surface)
1410+
&& !self
1411+
.overflow_popup
1412+
.as_ref()
1413+
.is_some_and(|(p, _)| p.c_popup.wl_surface() == surface)
1414+
&& !self.popups.iter().any(|p| p.popup.c_popup.wl_surface() == surface)
1415+
{
1416+
return;
1417+
}
14061418
}
14071419

14081420
self.s_focused_surface.retain(|(_, name)| name != seat_name);

0 commit comments

Comments
 (0)