workspace: Take a MetaWindow as argument to setReservedSlot()

And use it to lookup the local WindowClone that applies. Otherwise,
WorkspaceThumbnail.WindowClone objects may be mistakenly set, which
are not usable interchangeably with Workspace.WindowClone ones. This
may lead to several misbehaviors as fields available in the second
object but not in the first one are accessed, some those undefined
values get used in math ops, which result in NaNs over the place.

Likewise, the similar functions in WorkspacesViewBase subclasses take
now MetaWindow arguments too.

https://bugzilla.gnome.org/show_bug.cgi?id=735972
This commit is contained in:
Carlos Garnacho 2014-09-03 16:03:24 +02:00 committed by Florian Müllner
parent 8589bfb62e
commit b886656f61
2 changed files with 14 additions and 10 deletions

View File

@ -1209,14 +1209,18 @@ const Workspace = new Lang.Class({
return this._windows.length == 0;
},
setReservedSlot: function(clone) {
if (this._reservedSlot == clone)
setReservedSlot: function(metaWindow) {
if (this._reservedSlotWindow == metaWindow)
return;
if (clone && this.containsMetaWindow(clone.metaWindow))
clone = null;
if (!metaWindow || this.containsMetaWindow(metaWindow)) {
this._reservedSlotWindow = null;
this._reservedSlot = null;
} else {
this._reservedSlotWindow = metaWindow;
this._reservedSlot = this._windows[this._lookupIndex(metaWindow)];
}
this._reservedSlot = clone;
this._recalculateWindowPositions(WindowPositionFlags.ANIMATE);
},

View File

@ -65,7 +65,7 @@ const WorkspacesViewBase = new Lang.Class({
_dragBegin: function(overview, clone) {
this._inDrag = true;
this._setReservedSlot(clone);
this._setReservedSlot(clone.metaWindow);
},
_dragEnd: function() {
@ -127,9 +127,9 @@ const WorkspacesView = new Lang.Class({
Lang.bind(this, this._activeWorkspaceChanged));
},
_setReservedSlot: function(clone) {
_setReservedSlot: function(window) {
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setReservedSlot(clone);
this._workspaces[i].setReservedSlot(window);
},
_syncFullGeometry: function() {
@ -366,8 +366,8 @@ const ExtraWorkspaceView = new Lang.Class({
this.actor.add_actor(this._workspace.actor);
},
_setReservedSlot: function(clone) {
this._workspace.setReservedSlot(clone);
_setReservedSlot: function(window) {
this._workspace.setReservedSlot(window);
},
_syncFullGeometry: function() {