[gnome-shell] keyboard: Don't move focusWindow back down on window grab



commit 95b83575cbadb61967ce56f092e61e097c4fa6d3
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sat Feb 20 13:57:51 2021 +0100

    keyboard: Don't move focusWindow back down on window grab
    
    I suggested it myself when reviewing
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668, so
    here I am reverting that again...
    
    The difference between calling _setFocusWindow(null) and simply
    unsetting the focusWindow is that the former animates the window back to
    its position before we shifted it up, while the latter simply "lets go
    of the window".
    
    In this case we actually want the latter because after the user grabbed
    the window, we obviously should not animate it away right underneath the
    users pointer/finger.
    
    To ensure the same mistake doesn't happen again, add a small comment
    explaining why this code is as it is.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>

 js/ui/keyboard.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 43b4e5d27d..023b0484f4 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1275,7 +1275,11 @@ var Keyboard = GObject.registerClass({
         this._connectSignal(this._focusTracker, 'position-changed',
             this._onFocusPositionChanged.bind(this));
         this._connectSignal(this._focusTracker, 'window-grabbed', () => {
-            this._setFocusWindow(null);
+            // Don't use _setFocusWindow() here because that would move the
+            // window while the user has grabbed it. Instead we simply "let go"
+            // of the window.
+            this._focusWindow = null;
+            this._focusWindowStartY = null;
         });
         // Valid only for X11
         if (!Meta.is_wayland_compositor()) {


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