Only give keyboard focus to exclusive layer-shell surfaces

Workaround until we properly support on-demand.

See: https://github.com/YaLTeR/niri/issues/308
This commit is contained in:
Ivan Molodetskikh
2024-04-25 08:43:37 +04:00
parent fd6c8c7790
commit 04c5b9ad74
2 changed files with 13 additions and 11 deletions
+9 -8
View File
@@ -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;