Skip to content

Commit d9ceff7

Browse files
committed
Remove IME grab check, fix GTK 4 popups with IME
The wording in the deleted comment still stands: Smithay doesn't handle overlapping grabs. However, in this case things appear to more or less work themselves out. IME seems to re-request its grab every time an input field is focused, replacing the popup keyboard grab. And the popup keyboard grab doesn't seem to mind being replaced this way.
1 parent 813c5ee commit d9ceff7

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

src/handlers/xdg_shell.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use smithay::wayland::compositor::{
2323
HookId, SurfaceAttributes,
2424
};
2525
use smithay::wayland::dmabuf::get_dmabuf;
26-
use smithay::wayland::input_method::InputMethodSeat;
2726
use smithay::wayland::shell::kde::decoration::{KdeDecorationHandler, KdeDecorationState};
2827
use smithay::wayland::shell::wlr_layer::{self, Layer};
2928
use smithay::wayland::shell::xdg::decoration::XdgDecorationHandler;
@@ -267,15 +266,6 @@ impl XdgShellHandler for State {
267266
}
268267

269268
fn grab(&mut self, surface: PopupSurface, _seat: WlSeat, serial: Serial) {
270-
// HACK: ignore grabs (pretend they work without actually grabbing) if the input method has
271-
// a grab. It will likely need refactors in Smithay to support properly since grabs just
272-
// replace each other.
273-
// FIXME: do this properly.
274-
if self.niri.seat.input_method().keyboard_grabbed() {
275-
trace!("ignoring popup grab because IME has keyboard grabbed");
276-
return;
277-
}
278-
279269
let popup = PopupKind::Xdg(surface);
280270
let Ok(root) = find_popup_root_surface(&popup) else {
281271
trace!("ignoring popup grab because no root surface");

src/niri.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ use smithay::wayland::dmabuf::DmabufState;
8181
use smithay::wayland::fractional_scale::FractionalScaleManagerState;
8282
use smithay::wayland::idle_inhibit::IdleInhibitManagerState;
8383
use smithay::wayland::idle_notify::IdleNotifierState;
84-
use smithay::wayland::input_method::{InputMethodManagerState, InputMethodSeat};
84+
use smithay::wayland::input_method::InputMethodManagerState;
8585
use smithay::wayland::keyboard_shortcuts_inhibit::{
8686
KeyboardShortcutsInhibitState, KeyboardShortcutsInhibitor,
8787
};
@@ -1069,22 +1069,9 @@ impl State {
10691069
}
10701070

10711071
pub fn refresh_popup_grab(&mut self) {
1072-
let keyboard_grabbed = self.niri.seat.input_method().keyboard_grabbed();
1073-
10741072
if let Some(grab) = &mut self.niri.popup_grab {
10751073
if grab.grab.has_ended() {
10761074
self.niri.popup_grab = None;
1077-
} else if keyboard_grabbed {
1078-
// HACK: remove popup grab if IME grabbed the keyboard, because we can't yet do
1079-
// popup grabs together with an IME grab.
1080-
// FIXME: do this properly.
1081-
grab.grab.ungrab(PopupUngrabStrategy::All);
1082-
self.niri.seat.get_pointer().unwrap().unset_grab(
1083-
self,
1084-
SERIAL_COUNTER.next_serial(),
1085-
get_monotonic_time().as_millis() as u32,
1086-
);
1087-
self.niri.popup_grab = None;
10881075
}
10891076
}
10901077
}

0 commit comments

Comments
 (0)