** Description changed:
[Impact]
On Ubuntu 26.04 (mutter 50.1-0ubuntu2.4), every key an input method forwards
through GNOME Shell is
dropped before it reaches the focused Wayland client. Vietnamese input
methods (and any other IBus engine
that replaces already-committed text) forward BackSpace and then commit the
corrected text, so the
deletion never happens and the text is corrupted: typing the Telex sequence
`tieengs` produces
`tieêngếng` instead of `tiếng`.
Each dropped key logs:
gnome-shell[...]: clutter_event_key_new: assertion
'CLUTTER_IS_INPUT_DEVICE (source_device)' failed
Since mutter 50.0, `clutter_input_method_forward_key()` creates the key event
with a NULL source device,
which `clutter_event_key_new()` rejects. Upstream fixed this in 50.4 by
letting input-method events go
through without a device:
- Issue: https://gitlab.gnome.org/GNOME/mutter/-/work_items/4853
- MR: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/5121
- Commit: 2710ddc8a2515a0a77afde4cb9a70a4b14c72f14 (main), cherry-picked as
570de65dd05e1b362fdef90dcb811c22acd8a8e2 (gnome-50, in 50.4)
The fix is a one-line change in clutter/clutter/clutter-event.c. 24.04
(mutter 46) is not affected: it
passes the seat keyboard as the source device.
[Test Plan]
- 1. Ubuntu 26.04 GNOME Wayland session, fcitx5 acting as the IBus daemon (or
any IBus engine that emits
- ForwardKeyEvent for BackSpace), with an input method that replaces text
this way.
- 2. Focus a native Wayland text field that goes through GNOME Shell's input
method, e.g.
- gnome-text-editor without GTK_IM_MODULE set, or Chromium.
- 3. Type `tieengs`.
- - Without the fix: `tieêngếng`, and the assertion above is logged once per
forwarded press/release
- (24 lines for 3 attempts × 4 BackSpaces × press+release in our run).
- - With the fix: `tiếng`, no assertion.
+ 1. In an Ubuntu 26.04 GNOME Wayland session using IBus, install the
+ attached test engine:
- Measured on mutter 50.1-0ubuntu2.4 (affected) and upstream mutter 50.5
- (works).
+ sudo apt install ibus python3-gi gir1.2-ibus-1.0
+ sudo install -Dm755 LP-2169784-engine.py
/usr/local/libexec/LP-2169784-engine.py
+ sudo install -Dm644 LP-2169784-engine.xml
/usr/share/ibus/component/LP-2169784-engine.xml
+
+ Log out and back in. In Settings > Keyboard > Input Sources, add and select
+ “LP 2169784 ForwardKeyEvent test” (under English (United States), or under
Other).
+ 2. Open a new document in GNOME Text Editor as a native Wayland app with
+ GTK_IM_MODULE unset so it uses GNOME Shell's input method.
+ 3. Type `abcx`. The engine consumes `x` and forwards a BackSpace press and
release.
+ - Without the fix: `abc` remains, and GNOME Shell logs the assertion above.
+ - With the fix: `ab` remains, and there is no new assertion in the journal.
+ 4. Regression checks, with the default IBus and the updated mutter:
+ - An engine with preedit (e.g. ibus-libpinyin or ibus-anthy): preedit,
candidate selection and
+ commit work as before, in a Wayland app and in GNOME Shell entries
(overview search).
+ - With an input method active, keyboard shortcuts (Super, Alt+Tab,
Ctrl+Alt+T, media keys) still
+ work.
+
+ Cleanup: remove the test input source in Settings, delete the two installed
test files,
+ and log out and back in. The original Vietnamese-input case was measured on
mutter
+ 50.1-0ubuntu2.4 (affected) and upstream mutter 50.5 (works).
[Where problems could occur]
The change only relaxes a precondition for events flagged
CLUTTER_EVENT_FLAG_INPUT_METHOD; other key
events still require a source device. Code that assumes every key event has a
source device could see
a NULL device for input-method events; upstream relies on
clutter_event_get_source_device() being
nullable and has shipped this in 50.4, 50.5 and 51.
+
+ In mutter, the consumers on this path already handle a NULL device: the
Wayland seat accepts
+ input-method events without one, and shortcut inhibition ignores it. One
minor known gap
+ is in gnome-shell: if a forwarded key matches an accelerator grabbed over
D-Bus, that accelerator is
+ not delivered and a JS warning is logged (`device.get_device_node()` on NULL
in
+ `_emitAcceleratorSignal()`); gnome-shell keeps running. That is not a
regression, because these
+ events were dropped entirely before.
** Attachment added: "LP-2169784-engine.py"
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2169784/+attachment/6021538/+files/LP-2169784-engine.py
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169784
Title:
IBus ForwardKeyEvent is dropped for Wayland clients:
clutter_event_key_new assertion 'CLUTTER_IS_INPUT_DEVICE
(source_device)' failed (fixed upstream in 50.4)
To manage notifications about this bug go to:
https://bugs.launchpad.net/mutter/+bug/2169784/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs