From 351e6a4b21c7983c8427edc19d9ecfc453031010 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Thu, 17 Feb 2022 15:42:05 +0900 Subject: [PATCH] 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 --- libweston/bindings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libweston/bindings.c b/libweston/bindings.c index 2ca999a3..526379ab 100644 --- a/libweston/bindings.c +++ b/libweston/bindings.c @@ -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,