From 837a00c3f06c41cd2c7d27786620a7e4100ef583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 19 Jan 2018 15:00:10 +0100 Subject: [PATCH] workspace: Recompute bounding box on window 'position-changed' We need to update the clone position if window size changed also, rename meta window 'size-changed' callback accordingly. https://bugzilla.gnome.org/show_bug.cgi?id=792681 --- js/ui/workspace.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 06a9d7774..a183e0749 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -137,8 +137,10 @@ var WindowClone = new Lang.Class({ this._dragSlot = [0, 0, 0, 0]; this._stackAbove = null; - this._windowClone._updateId = this.metaWindow.connect('size-changed', - this._onRealWindowSizeChanged.bind(this)); + this._windowClone._sizeChangedId = this.metaWindow.connect('size-changed', + this._onMetaWindowSizeChanged.bind(this)); + this._windowClone._posChangedId = this.metaWindow.connect('position-changed', + this._computeBoundingBox.bind(this)); this._windowClone._destroyId = this.realWindow.connect('destroy', () => { // First destroy the clone and then destroy everything @@ -206,8 +208,7 @@ var WindowClone = new Lang.Class({ addAttachedDialog(win) { this._doAddAttachedDialog(win, win.get_compositor_private()); - this._computeBoundingBox(); - this.emit('size-changed'); + this._onMetaWindowSizeChanged(); }, hasAttachedDialogs() { @@ -216,15 +217,14 @@ var WindowClone = new Lang.Class({ _doAddAttachedDialog(metaWin, realWin) { let clone = new Clutter.Clone({ source: realWin }); - clone._updateId = metaWin.connect('size-changed', () => { - this._computeBoundingBox(); - this.emit('size-changed'); - }); + clone._sizeChangedId = metaWin.connect('size-changed', + this._onMetaWindowSizeChanged.bind(this)); + clone._posChangedId = metaWin.connect('position-changed', + this._onMetaWindowSizeChanged.bind(this)); clone._destroyId = realWin.connect('destroy', () => { clone.destroy(); - this._computeBoundingBox(); - this.emit('size-changed'); + this._onMetaWindowSizeChanged(); }); this.actor.add_child(clone); }, @@ -321,12 +321,13 @@ var WindowClone = new Lang.Class({ else realWindow = child.source; - realWindow.meta_window.disconnect(child._updateId); + realWindow.meta_window.disconnect(child._sizeChangedId); + realWindow.meta_window.disconnect(child._posChangedId); realWindow.disconnect(child._destroyId); }); }, - _onRealWindowSizeChanged() { + _onMetaWindowSizeChanged() { this._computeBoundingBox(); this.emit('size-changed'); },