workspacesView: Update scroll position but not workspace on allocate
Not updating the scroll position on allocate caused a glitch, where a window on a workspace that is not the first one would would be transparent for one frame when showing the overview. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3507 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1545>
This commit is contained in:
parent
15aabdf287
commit
1685c77931
@ -78,11 +78,10 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
|
|
||||||
this._animating = false; // tweening
|
this._animating = false; // tweening
|
||||||
this._gestureActive = false; // touch(pad) gestures
|
this._gestureActive = false; // touch(pad) gestures
|
||||||
this._updateScrollPositionId = 0;
|
|
||||||
|
|
||||||
this._scrollAdjustment = scrollAdjustment;
|
this._scrollAdjustment = scrollAdjustment;
|
||||||
this._onScrollId = this._scrollAdjustment.connect('notify::value',
|
this._onScrollId = this._scrollAdjustment.connect('notify::value',
|
||||||
this._updateScrollPosition.bind(this));
|
this._onScrollAdjustmentChanged.bind(this));
|
||||||
|
|
||||||
this._workspaces = [];
|
this._workspaces = [];
|
||||||
this._updateWorkspaces();
|
this._updateWorkspaces();
|
||||||
@ -125,14 +124,7 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
child.allocate_available_size(x, y, box.get_width(), box.get_height());
|
child.allocate_available_size(x, y, box.get_width(), box.get_height());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update scroll position in an idle callback to avoid unintended
|
|
||||||
// side effects (e.g. workspace switch) during layout.
|
|
||||||
this._updateScrollPositionId =
|
|
||||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
|
||||||
this._updateScrollPositionId = 0;
|
|
||||||
this._updateScrollPosition();
|
this._updateScrollPosition();
|
||||||
return GLib.SOURCE_REMOVE;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveWorkspace() {
|
getActiveWorkspace() {
|
||||||
@ -240,8 +232,6 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
super._onDestroy();
|
super._onDestroy();
|
||||||
|
|
||||||
if (this._updateScrollPositionId)
|
|
||||||
GLib.source_remove(this._updateScrollPositionId);
|
|
||||||
this._scrollAdjustment.disconnect(this._onScrollId);
|
this._scrollAdjustment.disconnect(this._onScrollId);
|
||||||
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
|
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
|
||||||
let workspaceManager = global.workspace_manager;
|
let workspaceManager = global.workspace_manager;
|
||||||
@ -265,15 +255,10 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
|
|
||||||
// sync the workspaces' positions to the value of the scroll adjustment
|
// sync the workspaces' positions to the value of the scroll adjustment
|
||||||
// and change the active workspace if appropriate
|
// and change the active workspace if appropriate
|
||||||
_updateScrollPosition() {
|
_onScrollAdjustmentChanged() {
|
||||||
if (!this.has_allocation())
|
if (!this.has_allocation())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._updateScrollPositionId) {
|
|
||||||
GLib.source_remove(this._updateScrollPositionId);
|
|
||||||
this._updateScrollPositionId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const adj = this._scrollAdjustment;
|
const adj = this._scrollAdjustment;
|
||||||
const allowSwitch =
|
const allowSwitch =
|
||||||
adj.get_transition('value') === null && !this._gestureActive;
|
adj.get_transition('value') === null && !this._gestureActive;
|
||||||
@ -296,9 +281,19 @@ class WorkspacesView extends WorkspacesViewBase {
|
|||||||
metaWorkspace.activate(global.get_current_time());
|
metaWorkspace.activate(global.get_current_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._updateScrollPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateScrollPosition() {
|
||||||
|
if (!this.has_allocation())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const adj = this._scrollAdjustment;
|
||||||
|
|
||||||
if (adj.upper == 1)
|
if (adj.upper == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const workspaceManager = global.workspace_manager;
|
||||||
const vertical = workspaceManager.layout_rows === -1;
|
const vertical = workspaceManager.layout_rows === -1;
|
||||||
const rtl = this.text_direction === Clutter.TextDirection.RTL;
|
const rtl = this.text_direction === Clutter.TextDirection.RTL;
|
||||||
const progress = vertical || !rtl
|
const progress = vertical || !rtl
|
||||||
|
Loading…
Reference in New Issue
Block a user