[gnome-shell] workspace: Don't freeze the layout when there's no layout yet
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspace: Don't freeze the layout when there's no layout yet
- Date: Sun, 6 Mar 2022 00:09:24 +0000 (UTC)
commit ba23279f1fd3820fb81570b1b4a03048e5a7a3bc
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Jan 31 21:13:18 2022 +0100
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>
js/ui/workspace.js | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 89f89dab92..ea48006bf5 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -424,6 +424,8 @@ var WorkspaceLayout = GObject.registerClass({
this._windowSlots = [];
this._layout = null;
+ this._needsLayout = true;
+
this._stateAdjustment = new St.Adjustment({
value: 0,
lower: 0,
@@ -663,9 +665,10 @@ var WorkspaceLayout = GObject.registerClass({
}
let layoutChanged = false;
- if (!this._layoutFrozen) {
- if (this._layout === null) {
+ if (!this._layoutFrozen || this._needsLayout) {
+ if (this._needsLayout) {
this._layout = this._createBestLayout(this._workarea);
+ this._needsLayout = false;
layoutChanged = true;
}
@@ -787,7 +790,7 @@ var WorkspaceLayout = GObject.registerClass({
this._windows.set(window, {
metaWindow,
sizeChangedId: metaWindow.connect('size-changed', () => {
- this._layout = null;
+ this._needsLayout = true;
this.layout_changed();
}),
destroyId: window.connect('destroy', () =>
@@ -807,7 +810,7 @@ var WorkspaceLayout = GObject.registerClass({
this._syncOverlay(window);
this._container.add_child(window);
- this._layout = null;
+ this._needsLayout = true;
this.layout_changed();
}
@@ -842,7 +845,7 @@ var WorkspaceLayout = GObject.registerClass({
if (window.get_parent() === this._container)
this._container.remove_child(window);
- this._layout = null;
+ this._needsLayout = true;
this.layout_changed();
}
@@ -861,7 +864,7 @@ var WorkspaceLayout = GObject.registerClass({
lastWindow = window;
}
- this._layout = null;
+ this._needsLayout = true;
this.layout_changed();
}
@@ -906,7 +909,7 @@ var WorkspaceLayout = GObject.registerClass({
this._spacing = s;
- this._layout = null;
+ this._needsLayout = true;
this.notify('spacing');
this.layout_changed();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]