Skip to content

Commit cfce45d

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 80cf2f2 commit cfce45d

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

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

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,16 +1370,29 @@ impl WrapperSpace for PanelSpace {
13701370
}
13711371

13721372
fn keyboard_leave(&mut self, seat_name: &str, f: Option<c_wl_surface::WlSurface>) {
1373-
// if not a leaf, return early
1374-
if let Some(surface) = f.as_ref()
1375-
&& self.popups.iter().any(|p| p.popup.parent == *surface)
1376-
{
1377-
return;
1378-
}
1379-
if self.layer.as_ref().zip(f).is_some_and(|l| l.0.wl_surface() == &l.1)
1380-
&& (self.popups.iter().any(|p| p.popup.grab) || self.overflow_popup.is_some())
1381-
{
1382-
return;
1373+
if let Some(surface) = f.as_ref() {
1374+
// if not a leaf, return early
1375+
if self.popups.iter().any(|p| p.popup.parent == *surface) {
1376+
return;
1377+
}
1378+
1379+
if self.layer.as_ref().is_some_and(|l| l.wl_surface() == surface)
1380+
&& (self.popups.iter().any(|p| p.popup.grab) || self.overflow_popup.is_some())
1381+
{
1382+
return;
1383+
}
1384+
1385+
// Ignore event for wl_surface that isn't our layer or popup (i.e. a different
1386+
// panel)
1387+
if !self.layer.as_ref().is_some_and(|l| l.wl_surface() == surface)
1388+
&& !self
1389+
.overflow_popup
1390+
.as_ref()
1391+
.is_some_and(|(p, _)| p.c_popup.wl_surface() == surface)
1392+
&& !self.popups.iter().any(|p| p.popup.c_popup.wl_surface() == surface)
1393+
{
1394+
return;
1395+
}
13831396
}
13841397

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

0 commit comments

Comments
 (0)