[mutter/wip/carlosg/im-forward-key: 6/6] clutter: Handle IM forwarded key events with no associated keycode
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/im-forward-key: 6/6] clutter: Handle IM forwarded key events with no associated keycode
- Date: Tue, 2 Oct 2018 11:27:01 +0000 (UTC)
commit 3167a884b2403bff746196992763903618e5377b
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Oct 2 13:05:27 2018 +0200
clutter: Handle IM forwarded key events with no associated keycode
Some IBus input methods currently attempt to forward key events with
keycode=0, and a keyval that couldn't be possibly looked up in the current
keymap. As the keyval is lost when going through wl_keyboard, this results
in clients ignoring the extraneous event.
It is however possible for the ClutterInputMethod to transparently transform
those into ::commit requests on the ClutterInputFocus. This is done during
event handling rather than delivery time so the relative ordering with other
forwarded events is preserved.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/619
clutter/clutter/clutter-input-method.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c
index cb5364b21..29d7c9420 100644
--- a/clutter/clutter/clutter-input-method.c
+++ b/clutter/clutter/clutter-input-method.c
@@ -437,7 +437,22 @@ clutter_input_method_filter_key_event (ClutterInputMethod *im,
g_return_val_if_fail (key != NULL, FALSE);
if (clutter_event_get_flags ((ClutterEvent *) key) & CLUTTER_EVENT_FLAG_INPUT_METHOD)
- return FALSE;
+ {
+ if (key->hardware_keycode == 0 && key->unicode_value > 0)
+ {
+ char str[7] = { 0, };
+
+ /* A virtual event with no associated keycode has been sent by
+ * the input method. postprocess it as commit() with the keyval's
+ * UTF-8 string.
+ */
+ g_unichar_to_utf8 (key->unicode_value, str);
+ clutter_input_method_commit (im, str);
+ return TRUE;
+ }
+
+ return FALSE;
+ }
if (!im_class->filter_key_event)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]