Don't send compositor's global key bindings to the input method

Although weston_compositor_run_key_binding() is called when the current
keyboard grab is default_grab or input_method_grab, swallowing the key
event is processed only on default_grab. As a result key events that
should be swallowed are sent to the input method unexpectedly.

For example, when a user press `Super + s` on weston-editor to take a
screen shot, `s` will be unexpectedly entered to the text area.
I confirmed such behaviour with weston-simple-im and fcitx5-5.0.10.
It doesn't occur with weston-keyboard because it doesn't install
keyboard grab.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
This commit is contained in:
Takuro Ashie 2022-02-17 15:42:05 +09:00 committed by Marius Vlad
parent 29d4472e13
commit 351e6a4b21
1 changed files with 2 additions and 2 deletions

View File

@ -310,8 +310,8 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
/* If this was a key binding and it didn't
* install a keyboard grab, install one now to
* swallow the key press. */
if (keyboard->grab ==
&keyboard->default_grab)
if (keyboard->grab == &keyboard->default_grab ||
keyboard->grab == &keyboard->input_method_grab)
install_binding_grab(keyboard,
time,
key,