[gnome-shell/wip/carlosg/osk-warning-fixes] keyboard: Refactor code resetting IM on window drags



commit ae4d8b28ccc16a713e86f236e865bbbe118e7aba
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 3 16:01:48 2018 +0200

    keyboard: Refactor code resetting IM on window drags
    
    When a window is dragged, the OSK should get hidden. Just
    do this in a nicer way.

 js/ui/keyboard.js | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 4a2494044..323c2f1fe 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -492,13 +492,17 @@ var FocusTracker = new Lang.Class({
 
     _init() {
         this._currentWindow = null;
-        this._currentWindowPositionId = 0;
 
         global.display.connect('notify::focus-window', () => {
             this._setCurrentWindow(global.display.focus_window);
             this.emit('window-changed', this._currentWindow);
         });
 
+        global.display.connect('grab-op-begin', (display, window, op) => {
+            if (window == this._currentWindow && op == Meta.GrabOp.MOVING)
+                this.emit('reset');
+        });
+
         /* Valid for wayland clients */
         Main.inputMethod.connect('cursor-location-changed', (o, rect) => {
             let newRect = { x: rect.get_x(), y: rect.get_y(), width: rect.get_width(), height: 
rect.get_height() };
@@ -520,16 +524,7 @@ var FocusTracker = new Lang.Class({
     },
 
     _setCurrentWindow(window) {
-        if (this._currentWindow)
-            this._currentWindow.disconnect(this._currentWindowPositionId);
-
         this._currentWindow = window;
-        if (window) {
-            this._currentWindowPositionId = this._currentWindow.connect('position-changed', () => {
-                if (global.display.get_grab_op() != Meta.GrabOp.NONE)
-                    this.emit('reset');
-            });
-        }
     },
 
     _setCurrentRect(rect) {


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