[gnome-shell/wip/carlosg/im-forward-key-take2] inputMethod: Use forward_key() method to forward key events



commit b01c0179e13c9ea16629fa56cbeefbade7cd92f6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Sep 27 21:09:02 2018 +0200

    inputMethod: Use forward_key() method to forward key events
    
    ClutterVirtualInputDevice has the limitation that event flags won't be
    made to contain CLUTTER_EVENT_FLAG_INPUT_METHOD, possibly causing feedback
    loops.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/531

 js/misc/inputMethod.js | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index ec84f7277..5f27ce084 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -29,9 +29,6 @@ var InputMethod = new Lang.Class({
                                                                  this._onSourceChanged.bind(this));
         this._currentSource = this._inputSourceManager.currentSource;
 
-        let deviceManager = Clutter.DeviceManager.get_default();
-        this._virtualDevice = deviceManager.create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
-
         if (this._ibus.is_connected())
             this._onConnected();
     },
@@ -133,8 +130,8 @@ var InputMethod = new Lang.Class({
             }
         }
 
-        this._virtualDevice.notify_key(Clutter.get_current_event_time(), keycode,
-                                       press ? Clutter.KeyState.PRESSED : Clutter.KeyState.RELEASED);
+        state &= ~(IBus.ModifierType.RELEASE_MASK);
+        this.forward_key(keyval, keycode + 8, state, press);
     },
 
     vfunc_focus_in(focus) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]