Blame SOURCES/0001-clutter-Add-clutter_input_method_forward_key-method.patch

776610
From 83808bbb02c0e4db40771358bf16237bd32ba2f2 Mon Sep 17 00:00:00 2001
776610
From: Carlos Garnacho <carlosg@gnome.org>
776610
Date: Thu, 27 Sep 2018 21:06:52 +0200
776610
Subject: [PATCH] clutter: Add clutter_input_method_forward_key() method.
776610
776610
This allows input methods to inject key events with specific keyval/keycode,
776610
those events will be flagged with CLUTTER_EVENT_FLAG_INPUT_METHOD so they
776610
won't be processed by the IM again.
776610
776610
https://gitlab.gnome.org/GNOME/gnome-shell/issues/531
776610
---
776610
 clutter/clutter/clutter-input-method.c | 44 ++++++++++++++++++++++++++
776610
 clutter/clutter/clutter-input-method.h |  8 +++++
776610
 2 files changed, 52 insertions(+)
776610
776610
diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c
776610
index 11d726d7b..cb5364b21 100644
776610
--- a/clutter/clutter/clutter-input-method.c
776610
+++ b/clutter/clutter/clutter-input-method.c
776610
@@ -25,6 +25,7 @@
776610
 #include "clutter/clutter-input-method.h"
776610
 #include "clutter/clutter-input-method-private.h"
776610
 #include "clutter/clutter-input-focus-private.h"
776610
+#include "clutter/clutter-device-manager-private.h"
776610
 
776610
 typedef struct _ClutterInputMethodPrivate ClutterInputMethodPrivate;
776610
 
776610
@@ -442,3 +443,46 @@ clutter_input_method_filter_key_event (ClutterInputMethod    *im,
776610
 
776610
   return im_class->filter_key_event (im, (const ClutterEvent *) key);
776610
 }
776610
+
776610
+void
776610
+clutter_input_method_forward_key (ClutterInputMethod *im,
776610
+                                  uint32_t            keyval,
776610
+                                  uint32_t            keycode,
776610
+                                  uint32_t            state,
776610
+                                  uint64_t            time_,
776610
+                                  gboolean            press)
776610
+{
776610
+  ClutterInputMethodPrivate *priv;
776610
+  ClutterDeviceManager *device_manager;
776610
+  ClutterInputDevice *keyboard;
776610
+  ClutterStage *stage;
776610
+  ClutterEvent *event;
776610
+
776610
+  g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
776610
+
776610
+  priv = clutter_input_method_get_instance_private (im);
776610
+  if (!priv->focus)
776610
+    return;
776610
+
776610
+  device_manager = clutter_device_manager_get_default ();
776610
+  keyboard = clutter_device_manager_get_core_device (device_manager,
776610
+                                                     CLUTTER_KEYBOARD_DEVICE);
776610
+  stage = _clutter_input_device_get_stage (keyboard);
776610
+  if (stage == NULL)
776610
+    return;
776610
+
776610
+  event = clutter_event_new (press ? CLUTTER_KEY_PRESS : CLUTTER_KEY_RELEASE);
776610
+  event->key.time = time_;
776610
+  event->key.flags = CLUTTER_EVENT_FLAG_INPUT_METHOD;
776610
+  event->key.modifier_state = state;
776610
+  event->key.keyval = keyval;
776610
+  event->key.hardware_keycode = keycode;
776610
+  event->key.unicode_value = clutter_keysym_to_unicode (keyval);
776610
+
776610
+  clutter_event_set_device (event, keyboard);
776610
+  clutter_event_set_source_device (event, keyboard);
776610
+  clutter_event_set_stage (event, stage);
776610
+
776610
+  clutter_event_put (event);
776610
+  clutter_event_free (event);
776610
+}
776610
diff --git a/clutter/clutter/clutter-input-method.h b/clutter/clutter/clutter-input-method.h
776610
index d37522d14..3aa549e24 100644
776610
--- a/clutter/clutter/clutter-input-method.h
776610
+++ b/clutter/clutter/clutter-input-method.h
776610
@@ -85,4 +85,12 @@ void clutter_input_method_notify_key_event (ClutterInputMethod *im,
776610
 CLUTTER_AVAILABLE_IN_MUTTER
776610
 void clutter_input_method_request_toggle_input_panel (ClutterInputMethod *im);
776610
 
776610
+CLUTTER_AVAILABLE_IN_MUTTER
776610
+void clutter_input_method_forward_key (ClutterInputMethod *im,
776610
+                                       uint32_t            keyval,
776610
+                                       uint32_t            keycode,
776610
+                                       uint32_t            state,
776610
+                                       uint64_t            time_,
776610
+                                       gboolean            press);
776610
+
776610
 #endif /* __CLUTTER_INPUT_METHOD_H__ */
776610
-- 
776610
2.20.1
776610