[gnome-shell/wip/carlosg/osk-x11-activation: 1/2] keyboard: Filter redundant FocusTracker::position-changed signals



commit 664d6f31f4db7dd366e0a46eb741451e57aa5406
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 17 21:04:48 2018 +0200

    keyboard: Filter redundant FocusTracker::position-changed signals
    
    Just emit the signal if it did actually change.

 js/ui/keyboard.js | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 44660be54..2e300cd3d 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -492,6 +492,7 @@ var FocusTracker = new Lang.Class({
 
     _init() {
         this._currentWindow = null;
+        this._rect = null;
 
         global.display.connect('notify::focus-window', () => {
             this._setCurrentWindow(global.display.focus_window);
@@ -535,6 +536,13 @@ var FocusTracker = new Lang.Class({
             rect.y -= frameRect.y;
         }
 
+        if (this._rect &&
+            this._rect.x == rect.x &&
+            this._rect.y == rect.y &&
+            this._rect.width == rect.width &&
+            this._rect.height == rect_height)
+            return;
+
         this._rect = rect;
         this.emit('position-changed');
     },


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