From 5d1d4b56c6a804aec324ca8e97f7e045ce49e958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 5 Mar 2022 13:42:21 +0100 Subject: [PATCH] overviewControls: Do consider work area for HIDDEN state While we don't want to position overview elements according to the work area, it does apply in the session when the overview is hidden. That is, we should take it into account for the HIDDEN state, so that transitions from and to the overview are correct. Part-of: --- js/ui/overviewControls.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 964043a82..1268697ee 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -47,14 +47,17 @@ class ControlsManagerLayout extends Clutter.BoxLayout { stateAdjustment.connect('notify::value', () => this.layout_changed()); } - _computeWorkspacesBoxForState(state, box, startY, searchHeight, dashHeight, thumbnailsHeight) { + _computeWorkspacesBoxForState(state, box, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) { const workspaceBox = box.copy(); const [width, height] = workspaceBox.get_size(); + const { y1: startY } = workAreaBox; const { spacing } = this; const { expandFraction } = this._workspacesThumbnails; switch (state) { case ControlsState.HIDDEN: + workspaceBox.set_origin(...workAreaBox.get_origin()); + workspaceBox.set_size(...workAreaBox.get_size()); break; case ControlsState.WINDOW_PICKER: workspaceBox.set_origin(0, @@ -77,8 +80,9 @@ class ControlsManagerLayout extends Clutter.BoxLayout { return workspaceBox; } - _getAppDisplayBoxForState(state, box, startY, searchHeight, dashHeight, appGridBox) { + _getAppDisplayBoxForState(state, box, workAreaBox, searchHeight, dashHeight, appGridBox) { const [width, height] = box.get_size(); + const { y1: startY } = workAreaBox; const appDisplayBox = new Clutter.ActorBox(); const { spacing } = this; @@ -133,7 +137,11 @@ class ControlsManagerLayout extends Clutter.BoxLayout { const monitor = Main.layoutManager.findMonitorForActor(this._container); const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index); + const startX = workArea.x - monitor.x; const startY = workArea.y - monitor.y; + const workAreaBox = new Clutter.ActorBox(); + workAreaBox.set_origin(startX, startY); + workAreaBox.set_size(workArea.width, workArea.height); box.y1 += startY; const [width, height] = box.get_size(); let availableHeight = height; @@ -173,7 +181,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout { } // Workspaces - let params = [box, startY, searchHeight, dashHeight, thumbnailsHeight]; + let params = [box, workAreaBox, searchHeight, dashHeight, thumbnailsHeight]; const transitionParams = this._stateAdjustment.getStateTransitionParams(); // Update cached boxes @@ -198,7 +206,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout { const workspaceAppGridBox = this._cachedWorkspaceBoxes.get(ControlsState.APP_GRID); - params = [box, startY, searchHeight, dashHeight, workspaceAppGridBox]; + params = [box, workAreaBox, searchHeight, dashHeight, workspaceAppGridBox]; let appDisplayBox; if (!transitionParams.transitioning) { appDisplayBox =