workspace: Don't freeze the layout when there's no layout yet
On some touchpads/laptops, the swipe gesture to open the overview can be performed so fast, that it starts and ends in between two frames. Now when this happens, and the gesture ended with too little movement to confidently say the user intended to open the overview, we'll close the overview again. While closing the overview, we freeze the layout of the Workspace in order to avoid changes to windows messing with the animation. This means that in the case described above, we freeze the layout even before the first frame of the opening animation happens. No frames being drawn also means no allocations happening, and since we create this._layout in vfunc_allocate(), this means that on the first allocation cycle of the overview we'll see this._layoutFrozen = true, but will also not have a this._layout nor this._windowSlots. This creates an annoying visual glitch where for a split second all the windows disappear (overview is visible but no WindowPreviews get allocated). To fix this, force creating a layout on the first allocation cycle, even if the layout is currently frozen. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2203>
This commit is contained in:
parent
c5cba77a5c
commit
ba23279f1f
@ -424,6 +424,8 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
this._windowSlots = [];
|
this._windowSlots = [];
|
||||||
this._layout = null;
|
this._layout = null;
|
||||||
|
|
||||||
|
this._needsLayout = true;
|
||||||
|
|
||||||
this._stateAdjustment = new St.Adjustment({
|
this._stateAdjustment = new St.Adjustment({
|
||||||
value: 0,
|
value: 0,
|
||||||
lower: 0,
|
lower: 0,
|
||||||
@ -663,9 +665,10 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let layoutChanged = false;
|
let layoutChanged = false;
|
||||||
if (!this._layoutFrozen) {
|
if (!this._layoutFrozen || this._needsLayout) {
|
||||||
if (this._layout === null) {
|
if (this._needsLayout) {
|
||||||
this._layout = this._createBestLayout(this._workarea);
|
this._layout = this._createBestLayout(this._workarea);
|
||||||
|
this._needsLayout = false;
|
||||||
layoutChanged = true;
|
layoutChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,7 +790,7 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
this._windows.set(window, {
|
this._windows.set(window, {
|
||||||
metaWindow,
|
metaWindow,
|
||||||
sizeChangedId: metaWindow.connect('size-changed', () => {
|
sizeChangedId: metaWindow.connect('size-changed', () => {
|
||||||
this._layout = null;
|
this._needsLayout = true;
|
||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
}),
|
}),
|
||||||
destroyId: window.connect('destroy', () =>
|
destroyId: window.connect('destroy', () =>
|
||||||
@ -807,7 +810,7 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
this._syncOverlay(window);
|
this._syncOverlay(window);
|
||||||
this._container.add_child(window);
|
this._container.add_child(window);
|
||||||
|
|
||||||
this._layout = null;
|
this._needsLayout = true;
|
||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,7 +845,7 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
if (window.get_parent() === this._container)
|
if (window.get_parent() === this._container)
|
||||||
this._container.remove_child(window);
|
this._container.remove_child(window);
|
||||||
|
|
||||||
this._layout = null;
|
this._needsLayout = true;
|
||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,7 +864,7 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
lastWindow = window;
|
lastWindow = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._layout = null;
|
this._needsLayout = true;
|
||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +909,7 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
|
|
||||||
this._spacing = s;
|
this._spacing = s;
|
||||||
|
|
||||||
this._layout = null;
|
this._needsLayout = true;
|
||||||
this.notify('spacing');
|
this.notify('spacing');
|
||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user