workspace: Scale slots to current workspace size when layout is frozen
The transition from the overview freezes the workspace layout at the start of the animation, which means that the calculated window slots remain the same while the workspace itslef grows. This causes the windows to appear slightly shrunk in comparison to the workspace and shifted to the top left. This is especially noticeable during the beginning of the animation when there is more weight on the slots than the original window position and if there are not that many open windows. Unfreezing the layout for this transition is not possible, because it would cause issues with newly opened windows abruptly changing the layout when the animation happens after starting a new app. This change instead tries to scale the frozen layout to the current workspace size. While this is not entirely correct, because this scales the spacing between the slots as well, it is still more accurate than the completely unscaled slots. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4616 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1980>
This commit is contained in:
parent
fc4f9f61fa
commit
6d3df381b3
@ -672,10 +672,13 @@ var WorkspaceLayout = GObject.registerClass({
|
||||
layoutChanged = true;
|
||||
}
|
||||
|
||||
if (layoutChanged || containerAllocationChanged)
|
||||
this._windowSlots = this._getWindowSlots(box.copy());
|
||||
if (layoutChanged || containerAllocationChanged) {
|
||||
this._windowSlotsBox = box.copy();
|
||||
this._windowSlots = this._getWindowSlots(this._windowSlotsBox);
|
||||
}
|
||||
}
|
||||
|
||||
const slotsScale = box.get_width() / this._windowSlotsBox.get_width();
|
||||
const workareaX = this._workarea.x;
|
||||
const workareaY = this._workarea.y;
|
||||
const workareaWidth = this._workarea.width;
|
||||
@ -691,6 +694,11 @@ var WorkspaceLayout = GObject.registerClass({
|
||||
if (!child.visible)
|
||||
continue;
|
||||
|
||||
x *= slotsScale;
|
||||
y *= slotsScale;
|
||||
width *= slotsScale;
|
||||
height *= slotsScale;
|
||||
|
||||
const windowInfo = this._windows.get(child);
|
||||
|
||||
let workspaceBoxX, workspaceBoxY;
|
||||
|
Loading…
Reference in New Issue
Block a user