Fix vertical assignments for gnome 48

This commit is contained in:
Charles Gagnon
2025-02-01 17:48:00 -05:00
parent 094ffeea30
commit 5e6bf9850e
3 changed files with 15 additions and 8 deletions

View File

@@ -1146,7 +1146,7 @@ export const Panel = GObject.registerClass(
}
if (actor instanceof St.BoxLayout) {
actor.vertical = isVertical
Utils.setBoxLayoutVertical(actor, isVertical)
} else if (
actor != this.statusArea.appMenu &&
((actor._delegate || actor) instanceof PanelMenu.ButtonBox ||

View File

@@ -535,6 +535,7 @@ export const Taskbar = class extends EventEmitter {
_updateIconAnimations(pointerX, pointerY) {
this._iconAnimationTimestamp = Date.now()
let type = iconAnimationSettings.type
let vertical = this.dtpPanel.checkIfVertical()
if (!pointerX || !pointerY) [pointerX, pointerY] = global.get_pointer()
@@ -542,10 +543,8 @@ export const Taskbar = class extends EventEmitter {
let [x, y] = item.get_transformed_position()
let [width, height] = item.get_transformed_size()
let [centerX, centerY] = [x + width / 2, y + height / 2]
let size = this._box.vertical ? height : width
let difference = this._box.vertical
? pointerY - centerY
: pointerX - centerX
let size = vertical ? height : width
let difference = vertical ? pointerY - centerY : pointerX - centerX
let distance = Math.abs(difference)
let maxDistance = (iconAnimationSettings.extent / 2) * size

View File

@@ -182,15 +182,23 @@ export const TimeoutsHandler = class extends BasicHandler {
}
export function createBoxLayout(options) {
if (options && Config.PACKAGE_VERSION >= '48') {
// https://mutter.gnome.org/clutter/enum.Orientation.html
options.orientation = options.vertical ? 1 : 0
if (options && 'vertical' in options) {
let vertical = options.vertical
delete options.vertical
setBoxLayoutVertical(options, vertical)
}
return new St.BoxLayout(options)
}
export function setBoxLayoutVertical(box, vertical) {
if (Config.PACKAGE_VERSION >= '48')
// https://mutter.gnome.org/clutter/enum.Orientation.html
box.orientation = vertical ? 1 : 0
else box.vertical = vertical
}
// This is wrapper to maintain compatibility with GNOME-Shell 3.30+ as well as
// previous versions.
export const DisplayWrapper = {