From 161e87e08844fbe476b6e80121baa8c787f431a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Daase?= Date: Sat, 29 Aug 2020 09:56:06 +0200 Subject: [PATCH] panel: remove flags from allocate call Similar to https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/9b99b67feabef01cb30e89962e50c094952d8852 to silence warnings in 3.38. --- unite@hardpixel.eu/panel.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/unite@hardpixel.eu/panel.js b/unite@hardpixel.eu/panel.js index edc0408..53062d8 100644 --- a/unite@hardpixel.eu/panel.js +++ b/unite@hardpixel.eu/panel.js @@ -6,12 +6,15 @@ const Shell = imports.gi.Shell const AppSystem = imports.gi.Shell.AppSystem.get_default() const WinTracker = imports.gi.Shell.WindowTracker.get_default() const Main = imports.ui.main +const Config = imports.misc.config const Unite = imports.misc.extensionUtils.getCurrentExtension() const AppMenu = Main.panel.statusArea.appMenu const Activities = Main.panel.statusArea.activities const Buttons = Unite.imports.buttons const Handlers = Unite.imports.handlers +const VERSION = parseInt(Config.PACKAGE_VERSION.split('.')[1]) + var PanelExtension = class PanelExtension { constructor(settings, key, callback) { this.activated = false @@ -200,14 +203,29 @@ var ExtendLeftBox = class ExtendLeftBox extends PanelExtension { _init() { this._default = Main.panel.__proto__.vfunc_allocate - Main.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', (box, flags) => { - Main.panel.vfunc_allocate.call(Main.panel, box, flags) - this._allocate(Main.panel, box, flags) - }) + if (VERSION < 37) { + Main.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', (box, flags) => { + Main.panel.vfunc_allocate.call(Main.panel, box, flags) + this._allocate(Main.panel, box, flags) + }) + } else { + Main.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', (box) => { + Main.panel.vfunc_allocate.call(Main.panel, box) + this._allocate(Main.panel, box) + }) + } Main.panel.queue_relayout() } + _boxAllocate(box, childBox, flags) { + if (VERSION < 37) { + box.allocate(childBox, flags) + } else { + box.allocate(childBox) + } + } + _allocate(actor, box, flags) { let leftBox = Main.panel._leftBox let centerBox = Main.panel._centerBox @@ -234,7 +252,7 @@ var ExtendLeftBox = class ExtendLeftBox extends PanelExtension { childBox.x2 = Math.min(Math.floor(sideWidth), leftNaturalWidth) } - leftBox.allocate(childBox, flags) + this._boxAllocate(leftBox, childBox, flags) childBox.y1 = 0 childBox.y2 = allocHeight @@ -247,7 +265,7 @@ var ExtendLeftBox = class ExtendLeftBox extends PanelExtension { childBox.x2 = childBox.x1 + centerNaturalWidth } - centerBox.allocate(childBox, flags) + this._boxAllocate(centerBox, childBox, flags) childBox.y1 = 0 childBox.y2 = allocHeight @@ -260,7 +278,7 @@ var ExtendLeftBox = class ExtendLeftBox extends PanelExtension { childBox.x2 = allocWidth } - rightBox.allocate(childBox, flags) + this._boxAllocate(rightBox, childBox, flags) } _destroy() {