diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2018-08-03 16:01:48 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-08-03 17:02:20 +0200 |
commit | 6b610b26f8bc2a9ef2ab121a1c6a55bf277d52b7 (patch) | |
tree | 7108c4ed92f409736459bfe467a202c52dc8edfa | |
parent | 81956e9b84a751e0aae739ef08017d3bfef907c8 (diff) | |
download | gnome-shell-wip/carlosg/osk-warning-fixes.tar.gz |
keyboard: Refactor code resetting IM on window dragswip/carlosg/osk-warning-fixes
When a window is dragged, the OSK should get hidden. Just
do this in a nicer way.
-rw-r--r-- | js/ui/keyboard.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 4a2494044..5d5f0e2c6 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -492,13 +492,18 @@ 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 || op == Meta.GrabOp.KEYBOARD_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 +525,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) { |