From 89f68deffc2cc5c5318497a5e6c1a2eae2217cd2 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Wed, 5 Mar 2025 15:03:39 -0500 Subject: [PATCH] Fix activities animation when vertical #2251 --- src/panelManager.js | 53 +++++++++++++++++++++++++++------------------ src/utils.js | 4 ++++ 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/panelManager.js b/src/panelManager.js index 77af957..11d430a 100755 --- a/src/panelManager.js +++ b/src/panelManager.js @@ -33,6 +33,7 @@ import * as PanelSettings from './panelSettings.js' import * as Proximity from './proximity.js' import * as Utils from './utils.js' import * as DesktopIconsIntegration from './desktopIconsIntegration.js' +import { DTP_EXTENSION, SETTINGS } from './extension.js' import GLib from 'gi://GLib' import GObject from 'gi://GObject' @@ -49,7 +50,6 @@ import { NotificationsMonitor } from './notificationsMonitor.js' import { Workspace } from 'resource:///org/gnome/shell/ui/workspace.js' import * as Layout from 'resource:///org/gnome/shell/ui/layout.js' import { InjectionManager } from 'resource:///org/gnome/shell/extensions/extension.js' -import { DTP_EXTENSION, SETTINGS } from './extension.js' import { SecondaryMonitorDisplay, WorkspacesView, @@ -97,24 +97,6 @@ export const PanelManager = class { global.dashToPanel.emit('panels-created') this._setDesktopIconsMargins() - //in 3.32, BoxPointer now inherits St.Widget - if (BoxPointer.BoxPointer.prototype.vfunc_get_preferred_height) { - let panelManager = this - - this._injectionManager.overrideMethod( - BoxPointer.BoxPointer.prototype, - 'vfunc_get_preferred_height', - () => - function (forWidth) { - let alloc = { min_size: 0, natural_size: 0 } - - ;[alloc.min_size, alloc.natural_size] = - this.vfunc_get_preferred_height(forWidth) - - return panelManager._getBoxPointerPreferredHeight(this, alloc) - }, - ) - } this._updatePanelElementPositions() @@ -175,6 +157,35 @@ export const PanelManager = class { Main.overview._overview._controls._workspacesDisplay, ) + let panelManager = this + this._injectionManager.overrideMethod( + BoxPointer.BoxPointer.prototype, + 'vfunc_get_preferred_height', + () => + function (forWidth) { + let alloc = { min_size: 0, natural_size: 0 } + + ;[alloc.min_size, alloc.natural_size] = + this.vfunc_get_preferred_height(forWidth) + + return panelManager._getBoxPointerPreferredHeight(this, alloc) + }, + ) + + this._injectionManager.overrideMethod( + Object.getPrototypeOf( + // WorkspaceDot in activities button + Main.panel.statusArea.activities.get_first_child().get_first_child(), + ), + 'vfunc_get_preferred_width', + (get_preferred_width) => + function (forHeight) { + return Utils.getBoxLayoutVertical(this.get_parent()) + ? [0, forHeight] + : get_preferred_width.call(this, forHeight) + }, + ) + LookingGlass.LookingGlass.prototype._oldResize = LookingGlass.LookingGlass.prototype._resize LookingGlass.LookingGlass.prototype._resize = _newLookingGlassResize @@ -335,8 +346,6 @@ export const PanelManager = class { } }) - this._injectionManager.clear() - if (Main.layoutManager.primaryMonitor) { Main.layoutManager.panelBox.set_position( Main.layoutManager.primaryMonitor.x, @@ -350,6 +359,8 @@ export const PanelManager = class { if (reset) return + this._injectionManager.clear() + this._setKeyBindings(false) this.notificationsMonitor.destroy() diff --git a/src/utils.js b/src/utils.js index 8e7f24b..547eae2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -203,6 +203,10 @@ export function setBoxLayoutVertical(box, vertical) { else box.vertical = vertical } +export function getBoxLayoutVertical(box) { + return Config.PACKAGE_VERSION >= '48' ? box.orientation == 1 : box.vertical +} + // This is wrapper to maintain compatibility with GNOME-Shell 3.30+ as well as // previous versions. export const DisplayWrapper = {