From f5642ab73376582d80da1edbabff8fd5a15632cb Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 23 Jan 2024 17:05:08 +0400 Subject: Ignore popup grabs when IME keyboard grab is active Doing this properly will require more refactors, potentially in Smithay. For now let's just ignore popup grabs to make popups work. --- src/handlers/xdg_shell.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/handlers') diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 221ca222..a8023a69 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -13,6 +13,7 @@ use smithay::reexports::wayland_server::protocol::wl_seat::WlSeat; use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; use smithay::utils::{Logical, Rectangle, Serial}; use smithay::wayland::compositor::{send_surface_state, with_states}; +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::xdg::decoration::XdgDecorationHandler; @@ -94,6 +95,15 @@ impl XdgShellHandler for State { } fn grab(&mut self, surface: PopupSurface, _seat: WlSeat, serial: Serial) { + // HACK: ignore grabs (pretend they work without actually grabbing) if the input method has + // a grab. It will likely need refactors in Smithay to support properly since grabs just + // replace each other. + // FIXME: do this properly. + if self.niri.seat.input_method().keyboard_grabbed() { + trace!("ignoring popup grab because IME has keyboard grabbed"); + return; + } + let popup = PopupKind::Xdg(surface); let Ok(root) = find_popup_root_surface(&popup) else { return; -- cgit