[gnome-shell] keyboard: Handle no-window case in FocusTracker
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] keyboard: Handle no-window case in FocusTracker
- Date: Tue, 17 Jul 2018 12:57:43 +0000 (UTC)
commit 0dee82fb9fa974ebdb4dd77fd85535a6edf207fd
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jul 17 01:36:38 2018 +0200
keyboard: Handle no-window case in FocusTracker
For windows, the cursor location needs to be adjusted by the frame
offsets. However we cannot assume that there is a window, as the
shell itself can have the key focus.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/414
js/ui/keyboard.js | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 41942eeaa..1fefb8c6c 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -533,17 +533,25 @@ var FocusTracker = new Lang.Class({
},
_setCurrentRect(rect) {
- let frameRect = this._currentWindow.get_frame_rect();
- rect.x -= frameRect.x;
- rect.y -= frameRect.y;
+ if (this._currentWindow) {
+ let frameRect = this._currentWindow.get_frame_rect();
+ rect.x -= frameRect.x;
+ rect.y -= frameRect.y;
+ }
this._rect = rect;
this.emit('position-changed');
},
getCurrentRect() {
- let frameRect = this._currentWindow.get_frame_rect();
- let rect = { x: this._rect.x + frameRect.x, y: this._rect.y + frameRect.y, width: this._rect.width,
height: this._rect.height };
+ let rect = { x: this._rect.x, y: this._rect.y,
+ width: this._rect.width, height: this._rect.height };
+
+ if (this._currentWindow) {
+ let frameRect = this._currentWindow.get_frame_rect();
+ rect.x += frameRect.x;
+ rect.y += frameRect.y;
+ }
return rect;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]