Fix problems when leaving the overview with a zoomed window

While zooming, a window clone is reparented to the stage and thus cannot
be destroyed automatically by the "parent" container. To prevent the clone
and the corresponding overlay from leaking, we enforce destroying the clone
with the workspace.

https://bugzilla.gnome.org/show_bug.cgi?id=609243
This commit is contained in:
Florian Müllner 2010-02-07 15:25:16 +01:00
parent bb0a977edc
commit 5429104f04

View File

@ -117,6 +117,7 @@ WindowClone.prototype = {
this.actor.connect('scroll-event',
Lang.bind(this, this._onScroll));
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.connect('enter-event',
Lang.bind(this, this._onEnter));
this.actor.connect('leave-event',
@ -143,6 +144,11 @@ WindowClone.prototype = {
this.actor.destroy();
},
_onDestroy: function() {
if (this._zoomLightbox)
this._zoomLightbox.destroy();
},
_onEnter: function (actor, event) {
// If the user drags faster than we can follow, he'll end up
// leaving the window temporarily and then re-entering it
@ -228,6 +234,11 @@ WindowClone.prototype = {
this.emit('zoom-end');
this.actor.reparent(this._origParent);
// If the workspace has been destroyed while we were reparented to
// the stage, _stackAbove will be unparented and we can't raise our
// actor above it - as we are bound to be destroyed anyway in that
// case, we can skip that step
if (this._stackAbove && this._stackAbove.get_parent())
this.actor.raise(this._stackAbove);
[this.actor.x, this.actor.y] = this._zoomLocalOrig.getPosition();
@ -1324,6 +1335,13 @@ Workspace.prototype = {
this._metaWorkspace.disconnect(this._windowAddedId);
this._metaWorkspace.disconnect(this._windowRemovedId);
// Usually, the windows will be destroyed automatically with
// their parent (this.actor), but we might have a zoomed window
// which has been reparented to the stage - _windows[0] holds
// the desktop window, which is never reparented
for (let w = 1; w < this._windows.length; w++)
this._windows[w].destroy();
},
// Sets this.leavingOverview flag to false.