Blame SOURCES/0001-keyboard-Handle-no-window-case-in-FocusTracker.patch

42f94a
From 6a796675bd7815087881b799ff5fc79e9ce2b0bf Mon Sep 17 00:00:00 2001
42f94a
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
42f94a
Date: Mon, 16 Jul 2018 23:36:38 +0000
42f94a
Subject: [PATCH] keyboard: Handle no-window case in FocusTracker
42f94a
42f94a
For windows, the cursor location needs to be adjusted by the frame
42f94a
offsets. However we cannot assume that there is a window, as the
42f94a
shell itself can have the key focus.
42f94a
42f94a
https://gitlab.gnome.org/GNOME/gnome-shell/issues/414
42f94a
42f94a
42f94a
(cherry picked from commit 0dee82fb9fa974ebdb4dd77fd85535a6edf207fd)
42f94a
---
42f94a
 js/ui/keyboard.js | 18 +++++++++++++-----
42f94a
 1 file changed, 13 insertions(+), 5 deletions(-)
42f94a
42f94a
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
42f94a
index 5fcdf988a7..66653d6027 100644
42f94a
--- a/js/ui/keyboard.js
42f94a
+++ b/js/ui/keyboard.js
42f94a
@@ -533,17 +533,25 @@ var FocusTracker = new Lang.Class({
42f94a
     },
42f94a
 
42f94a
     _setCurrentRect(rect) {
42f94a
-        let frameRect = this._currentWindow.get_frame_rect();
42f94a
-        rect.x -= frameRect.x;
42f94a
-        rect.y -= frameRect.y;
42f94a
+        if (this._currentWindow) {
42f94a
+            let frameRect = this._currentWindow.get_frame_rect();
42f94a
+            rect.x -= frameRect.x;
42f94a
+            rect.y -= frameRect.y;
42f94a
+        }
42f94a
 
42f94a
         this._rect = rect;
42f94a
         this.emit('position-changed');
42f94a
     },
42f94a
 
42f94a
     getCurrentRect() {
42f94a
-        let frameRect = this._currentWindow.get_frame_rect();
42f94a
-        let rect = { x: this._rect.x + frameRect.x, y: this._rect.y + frameRect.y, width: this._rect.width, height: this._rect.height };
42f94a
+        let rect = { x: this._rect.x, y: this._rect.y,
42f94a
+                     width: this._rect.width, height: this._rect.height };
42f94a
+
42f94a
+        if (this._currentWindow) {
42f94a
+            let frameRect = this._currentWindow.get_frame_rect();
42f94a
+            rect.x += frameRect.x;
42f94a
+            rect.y += frameRect.y;
42f94a
+        }
42f94a
 
42f94a
         return rect;
42f94a
     }
42f94a
-- 
42f94a
2.17.1
42f94a