From 04c5b9ad7489bfa6cbc7c109eb449fb81e0b4d5a Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 25 Apr 2024 08:43:37 +0400 Subject: Only give keyboard focus to exclusive layer-shell surfaces Workaround until we properly support on-demand. See: https://github.com/YaLTeR/niri/issues/308 --- src/handlers/xdg_shell.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/handlers') diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 0b0a5a33..6f627850 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -18,7 +18,7 @@ use smithay::wayland::compositor::{ }; use smithay::wayland::input_method::InputMethodSeat; use smithay::wayland::shell::kde::decoration::{KdeDecorationHandler, KdeDecorationState}; -use smithay::wayland::shell::wlr_layer::Layer; +use smithay::wayland::shell::wlr_layer::{self, Layer}; use smithay::wayland::shell::xdg::decoration::XdgDecorationHandler; use smithay::wayland::shell::xdg::{ PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler, @@ -121,19 +121,20 @@ impl XdgShellHandler for State { return; } } else { - if layers - .layers_on(Layer::Overlay) - .any(|l| l.can_receive_keyboard_focus()) - { + if layers.layers_on(Layer::Overlay).any(|l| { + l.cached_state().keyboard_interactivity + == wlr_layer::KeyboardInteractivity::Exclusive + }) { let _ = PopupManager::dismiss_popup(&root, &popup); return; } let mon = self.niri.layout.monitor_for_output(output).unwrap(); if !mon.render_above_top_layer() - && layers - .layers_on(Layer::Top) - .any(|l| l.can_receive_keyboard_focus()) + && layers.layers_on(Layer::Top).any(|l| { + l.cached_state().keyboard_interactivity + == wlr_layer::KeyboardInteractivity::Exclusive + }) { let _ = PopupManager::dismiss_popup(&root, &popup); return; -- cgit