From 498dc3cc982127a274c5d97ce90978688ce254e0 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Wed, 13 Apr 2022 22:29:57 -0400 Subject: [PATCH] Start removing legacy code --- appIcons.js | 69 +++++++-------- intellihide.js | 4 +- overview.js | 11 ++- panel.js | 217 ++++++++++++----------------------------------- panelManager.js | 30 ++----- panelStyle.js | 2 +- prefs.js | 1 - progress.js | 4 +- taskbar.js | 73 +++++++--------- transparency.js | 18 ++-- utils.js | 108 +++++------------------ windowPreview.js | 18 ++-- 12 files changed, 170 insertions(+), 385 deletions(-) diff --git a/appIcons.js b/appIcons.js index 008a08a..b76de32 100644 --- a/appIcons.js +++ b/appIcons.js @@ -142,13 +142,11 @@ var TaskbarAppIcon = GObject.registerClass({ }; // Hack for missing TOUCH_END event. this._onLeaveEvent = function(actor, event) { - this.actor.fake_release(); + this.fake_release(); if (this._menuTimeoutId != 0) this.activate(1); // Activate/launch the application if TOUCH_END didn't fire. this._removeMenuTimeout(); }; - Utils.wrapActor(this.icon); - Utils.wrapActor(this); this._dot.set_width(0); this._isGroupApps = Me.settings.get_boolean('group-apps'); @@ -157,7 +155,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._dotsContainer = new St.Widget({ layout_manager: new Clutter.BinLayout() }); this._dtpIconContainer = new St.Widget({ layout_manager: new Clutter.BinLayout(), style: getIconContainerStyle(panel.checkIfVertical()) }); - this.actor.remove_actor(this._iconContainer); + this.remove_actor(this._iconContainer); this._dtpIconContainer.add_child(this._iconContainer); @@ -184,10 +182,10 @@ var TaskbarAppIcon = GObject.registerClass({ } this._container.add_child(this._dotsContainer); - this.actor.set_child(this._container); + this.set_child(this._container); if (panel.checkIfVertical()) { - this.actor.set_width(panel.geom.w); + this.set_width(panel.geom.w); } // Monitor windows-changes instead of app state. @@ -223,7 +221,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._updateWindowTitleStyle.bind(this)); } - this._scrollEventId = this.actor.connect('scroll-event', this._onMouseScroll.bind(this)); + this._scrollEventId = this.connect('scroll-event', this._onMouseScroll.bind(this)); this._overviewWindowDragEndId = Main.overview.connect('window-drag-end', this._onOverviewWindowDragEnd.bind(this)); @@ -231,7 +229,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._switchWorkspaceId = global.window_manager.connect('switch-workspace', this._onSwitchWorkspace.bind(this)); - this._hoverChangeId = this.actor.connect('notify::hover', () => this._onAppIconHoverChanged()); + this._hoverChangeId = this.connect('notify::hover', () => this._onAppIconHoverChanged()); this._dtpSettingsSignalIds = [ Me.settings.connect('changed::animate-appicon-hover', this._onAnimateAppiconHoverChanged.bind(this)), @@ -279,10 +277,10 @@ var TaskbarAppIcon = GObject.registerClass({ // The source of the clone is this._container, // using this.actor directly would break DnD style. let clone = new Clutter.Clone({ - source: this.actor.child, - x: this.actor.child.x, y: this.actor.child.y, - width: this.actor.child.width, height: this.actor.child.height, - pivot_point: new Utils.getPoint({ x: 0.5, y: 0.5 }), + source: this.child, + x: this.child.x, y: this.child.y, + width: this.child.width, height: this.child.height, + pivot_point: new imports.gi.Graphene.Point({ x: 0.5, y: 0.5 }), opacity: 255, reactive: false, x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, @@ -291,8 +289,8 @@ var TaskbarAppIcon = GObject.registerClass({ // "clone" of this.actor return new St.Button({ child: clone, - x: this.actor.x, y: this.actor.y, - width: this.actor.width, height: this.actor.height, + x: this.x, y: this.y, + width: this.width, height: this.height, reactive: false, }); } @@ -303,7 +301,7 @@ var TaskbarAppIcon = GObject.registerClass({ this.getAppIconInterestingWindows().length > 0)) { return false; } else { - return this.actor.hover && !this.window && + return this.hover && !this.window && (!this._menu || !this._menu.isOpen) && (this._previewMenu.getCurrentAppIcon() !== this); } @@ -315,7 +313,7 @@ var TaskbarAppIcon = GObject.registerClass({ return; } - if (this.actor.hover) { + if (this.hover) { this._previewMenu.requestOpen(this); } else { this._previewMenu.requestClose(); @@ -360,11 +358,11 @@ var TaskbarAppIcon = GObject.registerClass({ Utils.getStageTheme().disconnect(this._scaleFactorChangedId); if (this._hoverChangeId) { - this.actor.disconnect(this._hoverChangeId); + this.disconnect(this._hoverChangeId); } if (this._scrollEventId) { - this.actor.disconnect(this._scrollEventId); + this.disconnect(this._scrollEventId); } for (let i = 0; i < this._dtpSettingsSignalIds.length; ++i) { @@ -395,13 +393,13 @@ var TaskbarAppIcon = GObject.registerClass({ // and position are random values, which might exceeds the integer range // resulting in an error when assigned to the a rect. This is a more like // a workaround to prevent flooding the system with errors. - if (this.actor.get_stage() == null) + if (this.get_stage() == null) return; let rect = new Meta.Rectangle(); - [rect.x, rect.y] = this.actor.get_transformed_position(); - [rect.width, rect.height] = this.actor.get_transformed_size(); + [rect.x, rect.y] = this.get_transformed_position(); + [rect.width, rect.height] = this.get_transformed_size(); let windows = this.window ? [this.window] : this.getAppIconInterestingWindows(true); windows.forEach(function(w) { @@ -476,9 +474,9 @@ var TaskbarAppIcon = GObject.registerClass({ visible: false }); - let mappedId = this.actor.connect('notify::mapped', () => { + let mappedId = this.connect('notify::mapped', () => { this._displayProperIndicator(); - this.actor.disconnect(mappedId); + this.disconnect(mappedId); }); } else { this._focusedDots = new St.DrawingArea(), @@ -641,7 +639,7 @@ var TaskbarAppIcon = GObject.registerClass({ let padding = getIconPadding(this.dtpPanel.monitor.index); let margin = Me.settings.get_int('appicon-margin'); - this.actor.set_style('padding:' + (this.dtpPanel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;')); + this.set_style('padding:' + (this.dtpPanel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;')); this._iconContainer.set_style('padding: ' + padding + 'px;'); } @@ -743,9 +741,9 @@ var TaskbarAppIcon = GObject.registerClass({ this._timeoutsHandler.add([T6, 0, () => { if (!this._destroyed) { if(isFocused) - this.actor.add_style_class_name('focused'); + this.add_style_class_name('focused'); else - this.actor.remove_style_class_name('focused'); + this.remove_style_class_name('focused'); } }]); @@ -830,8 +828,8 @@ var TaskbarAppIcon = GObject.registerClass({ // This is an attempt to determine if the theme is providing their own // running indicator by way of a border image on the icon, for example in // the theme Ciliora - return (this.icon.actor.get_stage() && - this.icon.actor.get_theme_node().get_border_image()); + return (this.icon.get_stage() && + this.icon.get_theme_node().get_border_image()); } activate(button, modifiers, handleAsGrouped) { @@ -1059,9 +1057,9 @@ var TaskbarAppIcon = GObject.registerClass({ for (let i = 1; i <= MAX_INDICATORS; i++){ let className = 'running'+i; if(i != this._nWindows) - this.actor.remove_style_class_name(className); + this.remove_style_class_name(className); else - this.actor.add_style_class_name(className); + this.add_style_class_name(className); } } @@ -1634,9 +1632,6 @@ function ItemShowLabel() { constructor(dtpPanel) { this.realShowAppsIcon = new Dash.ShowAppsIcon(); - Utils.wrapActor(this.realShowAppsIcon); - Utils.wrapActor(this.realShowAppsIcon.toggleButton); - /* the variable equivalent to toggleButton has a different name in the appIcon class (actor): duplicate reference to easily reuse appIcon methods */ this.actor = this.realShowAppsIcon.toggleButton; @@ -1666,7 +1661,7 @@ function ItemShowLabel() { let customIconPath = Me.settings.get_string('show-apps-icon-file'); this.realShowAppsIcon.icon.createIcon = function(size) { - this._iconActor = new St.Icon({ icon_name: 'view' + (Config.PACKAGE_VERSION < '3.20' ? '' : '-app') + '-grid-symbolic', + this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic', icon_size: size, style_class: 'show-apps-icon', track_hover: true }); @@ -1869,11 +1864,7 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { let settingsMenuItem = this._appendMenuItem(_('Dash to Panel Settings')); settingsMenuItem.connect('activate', function () { - let command = ["gnome-shell-extension-prefs"]; - - if (Config.PACKAGE_VERSION > '3.36') { - command = ["gnome-extensions", "prefs"]; - } + let command = ["gnome-extensions", "prefs"]; Util.spawn(command.concat([Me.metadata.uuid])); }); diff --git a/intellihide.js b/intellihide.js index 7e2aed8..db0a738 100644 --- a/intellihide.js +++ b/intellihide.js @@ -342,13 +342,13 @@ var Intellihide = class { if (GrabHelper._grabHelperStack) // gnome-shell < 42 - isGrab = GrabHelper._grabHelperStack.some(gh => gh._owner == this._dtpPanel.panel.actor) + isGrab = GrabHelper._grabHelperStack.some(gh => gh._owner == this._dtpPanel.panel) else if (global.stage.get_grab_actor) { // gnome-shell >= 42 let sourceActor = global.stage.get_grab_actor()?._sourceActor isGrab = sourceActor && (sourceActor == Main.layoutManager.dummyCursor || - this._dtpPanel.panel.actor.contains(sourceActor)) + this._dtpPanel.panel.contains(sourceActor)) } if (isGrab) diff --git a/overview.js b/overview.js index b88a2c2..3c5977f 100644 --- a/overview.js +++ b/overview.js @@ -25,7 +25,6 @@ const Intellihide = Me.imports.intellihide; const Utils = Me.imports.utils; const Clutter = imports.gi.Clutter; -const Config = imports.misc.config; const Main = imports.ui.main; const Shell = imports.gi.Shell; const Gtk = imports.gi.Gtk; @@ -104,8 +103,8 @@ var Overview = class { let height = visible ? -1 : LABEL_MARGIN * Utils.getScaleFactor(); let overviewControls = Main.overview._overview._controls; - overviewControls.dash.actor[visibilityFunc](); - overviewControls.dash.actor.set_height(height); + overviewControls.dash[visibilityFunc](); + overviewControls.dash.set_height(height); } _adaptAlloc(enable) { @@ -218,7 +217,7 @@ var Overview = class { this._hotkeyPreviewCycleInfo = { appIcon: appIcon, currentWindow: appIcon.window, - keyFocusOutId: appIcon.actor.connect('key-focus-out', () => appIcon.actor.grab_key_focus()), + keyFocusOutId: appIcon.connect('key-focus-out', () => appIcon.grab_key_focus()), capturedEventId: global.stage.connect('captured-event', (actor, e) => { if (e.type() == Clutter.EventType.KEY_RELEASE && e.get_key_symbol() == (Clutter.KEY_Super_L || Clutter.Super_L)) { this._endHotkeyPreviewCycle(true); @@ -231,7 +230,7 @@ var Overview = class { appIcon._hotkeysCycle = appIcon.window; appIcon.window = null; appIcon._previewMenu.open(appIcon, true); - appIcon.actor.grab_key_focus(); + appIcon.grab_key_focus(); } appIcon._previewMenu.focusNext(); @@ -247,7 +246,7 @@ var Overview = class { _endHotkeyPreviewCycle(focusWindow) { if (this._hotkeyPreviewCycleInfo) { global.stage.disconnect(this._hotkeyPreviewCycleInfo.capturedEventId); - this._hotkeyPreviewCycleInfo.appIcon.actor.disconnect(this._hotkeyPreviewCycleInfo.keyFocusOutId); + this._hotkeyPreviewCycleInfo.appIcon.disconnect(this._hotkeyPreviewCycleInfo.keyFocusOutId); if (focusWindow) { this._hotkeyPreviewCycleInfo.appIcon._previewMenu.activateFocused(); diff --git a/panel.js b/panel.js index c8009a0..5fb0040 100644 --- a/panel.js +++ b/panel.js @@ -102,8 +102,6 @@ var Panel = GObject.registerClass({ this.panel = new SecondaryPanel({ name: 'panel', reactive: true }); this.statusArea = this.panel.statusArea = {}; - Utils.wrapActor(this.panel); - //next 3 functions are needed by other extensions to add elements to the secondary panel this.panel.addToStatusArea = function(role, indicator, position, box) { return Main.panel.addToStatusArea.call(this, role, indicator, position, box); @@ -123,9 +121,9 @@ var Panel = GObject.registerClass({ this.menuManager = this.panel.menuManager = new PopupMenu.PopupMenuManager(this.panel); - this._setPanelMenu('aggregateMenu', SecondaryAggregateMenu, this.panel.actor); - this._setPanelMenu('dateMenu', DateMenu.DateMenuButton, this.panel.actor); - this._setPanelMenu('activities', GSPanel.ActivitiesButton, this.panel.actor); + this._setPanelMenu('aggregateMenu', GSPanel.AggregateMenu, this.panel); + this._setPanelMenu('dateMenu', DateMenu.DateMenuButton, this.panel); + this._setPanelMenu('activities', GSPanel.ActivitiesButton, this.panel); this.panel.add_child(this._leftBox); this.panel.add_child(this._centerBox); @@ -143,24 +141,22 @@ var Panel = GObject.registerClass({ container._dtpOriginalParent = parent; parent ? parent.remove_child(container) : null; - this.panel.actor.add_child(container); + this.panel.add_child(container); }); } // Create a wrapper around the real showAppsIcon in order to add a popupMenu. Most of // its behavior is handled by the taskbar, but its positioning is done at the panel level this.showAppsIconWrapper = new AppIcons.ShowAppsIconWrapper(this); - this.panel.actor.add_child(this.showAppsIconWrapper.realShowAppsIcon); + this.panel.add_child(this.showAppsIconWrapper.realShowAppsIcon); - this.panel.actor._delegate = this; + this.panel._delegate = this; - Utils.wrapActor(this.statusArea.activities); - - this.add_child(this.panel.actor); + this.add_child(this.panel); if (Main.panel._onButtonPress || Main.panel._tryDragWindow) { this._signalsHandler.add([ - this.panel.actor, + this.panel, [ 'button-press-event', 'touch-event' @@ -170,7 +166,7 @@ var Panel = GObject.registerClass({ } if (Main.panel._onKeyPress) { - this._signalsHandler.add([this.panel.actor, 'key-press-event', Main.panel._onKeyPress.bind(this)]); + this._signalsHandler.add([this.panel, 'key-press-event', Main.panel._onKeyPress.bind(this)]); } Main.ctrlAltTabManager.addGroup(this, _("Top Bar")+" "+ monitor.index, 'focus-top-bar-symbolic', @@ -192,29 +188,21 @@ var Panel = GObject.registerClass({ } if (Config.PACKAGE_VERSION < '42' && this.panel._leftCorner) { - Utils.wrapActor(this.panel._leftCorner); - Utils.wrapActor(this.panel._rightCorner); - if (isTop) { if (this.isStandalone) { - this.panel.actor.add_child(this.panel._leftCorner.actor); - this.panel.actor.add_child(this.panel._rightCorner.actor); + this.panel.add_child(this.panel._leftCorner); + this.panel.add_child(this.panel._rightCorner); } - } else if (Config.PACKAGE_VERSION >= '3.32') { - this.panel.actor.remove_child(this.panel._leftCorner.actor); - this.panel.actor.remove_child(this.panel._rightCorner.actor); + } else { + this.panel.remove_child(this.panel._leftCorner); + this.panel.remove_child(this.panel._rightCorner); } } this._setPanelPosition(); if (!this.isStandalone) { - if (this.panel.vfunc_allocate) { - this._panelConnectId = 0; - Utils.hookVfunc(Object.getPrototypeOf(this.panel), 'allocate', (box, flags) => this._mainPanelAllocate(0, box, flags)); - } else { - this._panelConnectId = this.panel.actor.connect('allocate', (actor, box, flags) => this._mainPanelAllocate(actor, box, flags)); - } + Utils.hookVfunc(Object.getPrototypeOf(this.panel), 'allocate', (box) => this._mainPanelAllocate(box)); // remove the extra space before the clock when the message-indicator is displayed if (DateMenu.IndicatorPad) { @@ -231,18 +219,6 @@ var Panel = GObject.registerClass({ indicatorPad.clear_constraints(); } - // The main panel's connection to the "allocate" signal is competing with this extension - // trying to move the centerBox over to the right, creating a never-ending cycle. - // Since we don't have the ID to disconnect that handler, wrap the allocate() function - // it calls instead. If the call didn't originate from this file, ignore it. - panelBoxes.forEach(b => { - this[b].allocate = (box, flags, isFromDashToPanel) => { - if (isFromDashToPanel) { - Utils.allocate(this[b], box, flags, true); - } - } - }); - this.menuManager._oldChangeMenu = this.menuManager._changeMenu; this.menuManager._changeMenu = (menu) => { if (!Me.settings.get_boolean('stockgs-panelbtn-click-only')) { @@ -254,14 +230,14 @@ var Panel = GObject.registerClass({ this.taskbar = new Taskbar(this); - this.panel.actor.add_child(this.taskbar.actor); + this.panel.add_child(this.taskbar.actor); this._setAppmenuVisible(Me.settings.get_boolean('show-appmenu')); this._setShowDesktopButton(true); this._setAllocationMap(); - this.panel.actor.add_style_class_name('dashtopanelMainPanel ' + this.getOrientation()); + this.panel.add_style_class_name('dashtopanelMainPanel ' + this.getOrientation()); this._timeoutsHandler.add([T2, Me.settings.get_int('intellihide-enable-start-delay'), () => this.intellihide = new Intellihide.Intellihide(this)]); @@ -276,7 +252,7 @@ var Panel = GObject.registerClass({ // sync hover after a popupmenu is closed this.taskbar, 'menu-closed', - () => this.panel.actor.sync_hover() + () => this.panel.sync_hover() ], [ Main.overview, @@ -317,7 +293,7 @@ var Panel = GObject.registerClass({ () => this._onBoxActorAdded(this._rightBox) ], [ - this.panel.actor, + this.panel, 'scroll-event', this._onPanelMouseScroll.bind(this) ], @@ -369,7 +345,7 @@ var Panel = GObject.registerClass({ this._signalsHandler.destroy(); this._disablePanelCornerSignals(); - this.panel.actor.remove_child(this.taskbar.actor); + this.panel.remove_child(this.taskbar.actor); this._setAppmenuVisible(false); if (this.intellihide) { @@ -385,7 +361,6 @@ var Panel = GObject.registerClass({ this.menuManager._changeMenu = this.menuManager._oldChangeMenu; - panelBoxes.forEach(b => delete this[b].allocate); this._unmappedButtons.forEach(a => this._disconnectVisibleId(a)); if (this.statusArea.dateMenu) { @@ -399,27 +374,27 @@ var Panel = GObject.registerClass({ } } - this._setVertical(this.panel.actor, false); + this._setVertical(this.panel, false); this._setVertical(this._centerBox, false); this._setVertical(this._rightBox, false); if (!this.isStandalone) { - ['vertical', 'horizontal', 'dashtopanelMainPanel'].forEach(c => this.panel.actor.remove_style_class_name(c)); + ['vertical', 'horizontal', 'dashtopanelMainPanel'].forEach(c => this.panel.remove_style_class_name(c)); if (!Main.sessionMode.isLocked) { [['activities', 0], ['aggregateMenu', -1], ['dateMenu', 0]].forEach(b => { let container = this.statusArea[b[0]].container; let originalParent = container._dtpOriginalParent; - this.panel.actor.remove_child(container); + this.panel.remove_child(container); originalParent ? originalParent.insert_child_at_index(container, b[1]) : null; delete container._dtpOriginalParent; }); } - if (Config.PACKAGE_VERSION < '42' && !this.panel._leftCorner.actor.mapped) { - this.panel.actor.add_child(this.panel._leftCorner.actor); - this.panel.actor.add_child(this.panel._rightCorner.actor); + if (Config.PACKAGE_VERSION < '42' && !this.panel._leftCorner.mapped) { + this.panel.add_child(this.panel._leftCorner); + this.panel.add_child(this.panel._rightCorner); } this._setShowDesktopButton(false); @@ -431,13 +406,9 @@ var Panel = GObject.registerClass({ Utils.hookVfunc(DateMenu.IndicatorPad.prototype, 'get_preferred_height', DateMenu.IndicatorPad.prototype.vfunc_get_preferred_height); } - if (this._panelConnectId) { - this.panel.actor.disconnect(this._panelConnectId); - } else { - Utils.hookVfunc(Object.getPrototypeOf(this.panel), 'allocate', Object.getPrototypeOf(this.panel).vfunc_allocate); - } + Utils.hookVfunc(Object.getPrototypeOf(this.panel), 'allocate', Object.getPrototypeOf(this.panel).vfunc_allocate); - this.panel.actor._delegate = this.panel; + this.panel._delegate = this.panel; } else { this._removePanelMenu('dateMenu'); this._removePanelMenu('aggregateMenu'); @@ -508,8 +479,8 @@ var Panel = GObject.registerClass({ } } - this.panel.actor.hide(); - this.panel.actor.show(); + this.panel.hide(); + this.panel.show(); } _updateGroupedElements(panelPositions) { @@ -794,29 +765,28 @@ var Panel = GObject.registerClass({ _setAllocationMap() { this.allocationMap = {}; - let setMap = (name, actor, isBox) => this.allocationMap[name] = { + let setMap = (name, actor) => this.allocationMap[name] = { actor: actor, - isBox: isBox || 0, box: new Clutter.ActorBox() }; setMap(Pos.SHOW_APPS_BTN, this.showAppsIconWrapper.realShowAppsIcon); setMap(Pos.ACTIVITIES_BTN, this.statusArea.activities ? this.statusArea.activities.container : 0); - setMap(Pos.LEFT_BOX, this._leftBox, 1); + setMap(Pos.LEFT_BOX, this._leftBox); setMap(Pos.TASKBAR, this.taskbar.actor); - setMap(Pos.CENTER_BOX, this._centerBox, 1); + setMap(Pos.CENTER_BOX, this._centerBox); setMap(Pos.DATE_MENU, this.statusArea.dateMenu.container); setMap(Pos.SYSTEM_MENU, this.statusArea.aggregateMenu.container); - setMap(Pos.RIGHT_BOX, this._rightBox, 1); + setMap(Pos.RIGHT_BOX, this._rightBox); setMap(Pos.DESKTOP_BTN, this._showDesktopButton); } - _mainPanelAllocate(actor, box, flags) { - Utils.setAllocation(this.panel.actor, box, flags); + _mainPanelAllocate(box) { + this.panel.set_allocation(box); } - vfunc_allocate(box, flags) { - Utils.setAllocation(this, box, flags); + vfunc_allocate(box) { + this.set_allocation(box); let fixed = 0; let centeredMonitorGroup; @@ -835,7 +805,7 @@ var Panel = GObject.registerClass({ if (!group.isCentered || Pos.checkIfCentered(element.position)) { group.size += element.natSize; - } else if (element.position == Pos.STACKED_TL) {  + } else if (element.position == Pos.STACKED_TL) { group.tlOffset += element.natSize; } else { // Pos.STACKED_BR group.brOffset += element.natSize; @@ -901,11 +871,7 @@ var Panel = GObject.registerClass({ element.box[this.varCoord.c1] = Math.round(currentPosition); element.box[this.varCoord.c2] = Math.round((currentPosition += element.natSize)); - if (element.isBox) { - return element.actor.allocate(element.box, flags, true); - } - - Utils.allocate(element.actor, element.box, flags, false); + element.actor.allocate(element.box); }); group[this.varCoord.c1] = startPosition; @@ -914,7 +880,7 @@ var Panel = GObject.registerClass({ ++fixed; }; - Utils.allocate(this.panel.actor, panelAlloc, flags); + this.panel.allocate(panelAlloc); this._elementGroups.forEach(group => { group.fixed = 0; @@ -962,7 +928,7 @@ var Panel = GObject.registerClass({ let currentCornerSize = this.cornerSize; let panelAllocFixedSize = box[this.fixedCoord.c2] - box[this.fixedCoord.c1]; - [ , this.cornerSize] = this.panel._leftCorner.actor[this.sizeFunc](-1); + [ , this.cornerSize] = this.panel._leftCorner[this.sizeFunc](-1); childBoxLeftCorner[this.varCoord.c1] = 0; childBoxLeftCorner[this.varCoord.c2] = this.cornerSize; @@ -974,8 +940,8 @@ var Panel = GObject.registerClass({ childBoxRightCorner[this.fixedCoord.c1] = panelAllocFixedSize; childBoxRightCorner[this.fixedCoord.c2] = panelAllocFixedSize + this.cornerSize; - Utils.allocate(this.panel._leftCorner.actor, childBoxLeftCorner, flags); - Utils.allocate(this.panel._rightCorner.actor, childBoxRightCorner, flags); + this.panel._leftCorner.allocate(childBoxLeftCorner); + this.panel._rightCorner.allocate(childBoxRightCorner); if (this.cornerSize != currentCornerSize) { this._setPanelClip(); @@ -989,13 +955,13 @@ var Panel = GObject.registerClass({ this.set_size(this.geom.w, this.geom.h); clipContainer.set_position(this.geom.x, this.geom.y); - this._setVertical(this.panel.actor, this.checkIfVertical()); + this._setVertical(this.panel, this.checkIfVertical()); // styles for theming Object.keys(St.Side).forEach(p => { let cssName = 'dashtopanel' + p.charAt(0) + p.slice(1).toLowerCase(); - this.panel.actor[(St.Side[p] == this.geom.position ? 'add' : 'remove') + '_style_class_name'](cssName); + this.panel[(St.Side[p] == this.geom.position ? 'add' : 'remove') + '_style_class_name'](cssName); }); this._setPanelClip(clipContainer); @@ -1015,7 +981,7 @@ var Panel = GObject.registerClass({ let button = isPress ? event.get_button() : -1; let [stageX, stageY] = event.get_coords(); - if (button == 3 && global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, stageX, stageY) == this.panel.actor) { + if (button == 3 && global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, stageX, stageY) == this.panel) { //right click on an empty part of the panel, temporarily borrow and display the showapps context menu Main.layoutManager.setDummyCursorGeometry(stageX, stageY, 0, 0); @@ -1230,12 +1196,12 @@ var Panel = GObject.registerClass({ } }); - this.panel.actor.add_child(this._showDesktopButton); + this.panel.add_child(this._showDesktopButton); } else { if(!this._showDesktopButton) return; - this.panel.actor.remove_child(this._showDesktopButton); + this.panel.remove_child(this._showDesktopButton); this._showDesktopButton.destroy(); this._showDesktopButton = null; } @@ -1382,86 +1348,7 @@ var SecondaryPanel = GObject.registerClass({ super._init(params); } - vfunc_allocate(box, flags) { - Utils.setAllocation(this, box, flags); + vfunc_allocate(box) { + this.set_allocation(box); } -}); - -var SecondaryAggregateMenu = GObject.registerClass({ -}, class SecondaryAggregateMenu extends PanelMenu.Button { - - _init() { - super._init(0.0, C_("System menu in the top bar", "System"), false); - - Utils.wrapActor(this); - - this.menu.actor.add_style_class_name('aggregate-menu'); - - let menuLayout = new GSPanel.AggregateLayout(); - this.menu.box.set_layout_manager(menuLayout); - - this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' }); - this.actor.add_child(this._indicators); - - this._power = new imports.ui.status.power.Indicator(); - this._volume = new imports.ui.status.volume.Indicator(); - this._brightness = new imports.ui.status.brightness.Indicator(); - this._system = new imports.ui.status.system.Indicator(); - - if (Config.PACKAGE_VERSION >= '3.28') { - this._thunderbolt = new imports.ui.status.thunderbolt.Indicator(); - this._indicators.add_child(Utils.getIndicators(this._thunderbolt)); - } - - if (Config.PACKAGE_VERSION < '3.37') { - this._screencast = new imports.ui.status.screencast.Indicator(); - this._indicators.add_child(Utils.getIndicators(this._screencast)); - } - - if (Config.PACKAGE_VERSION >= '3.24') { - this._nightLight = new imports.ui.status.nightLight.Indicator(); - this._indicators.add_child(Utils.getIndicators(this._nightLight)); - } - - if (Config.HAVE_NETWORKMANAGER && Config.PACKAGE_VERSION >= '3.24') { - this._network = new imports.ui.status.network.NMApplet(); - this._indicators.add_child(Utils.getIndicators(this._network)); - } - - if (Config.HAVE_BLUETOOTH) { - this._bluetooth = new imports.ui.status.bluetooth.Indicator(); - this._indicators.add_child(Utils.getIndicators(this._bluetooth)); - } - - this._indicators.add_child(Utils.getIndicators(this._volume)); - this._indicators.add_child(Utils.getIndicators(this._power)); - - this.menu.addMenuItem(this._volume.menu); - this._volume._volumeMenu._readOutput(); - this._volume._volumeMenu._readInput(); - - this.menu.addMenuItem(this._brightness.menu); - this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - - if (this._network) { - this.menu.addMenuItem(this._network.menu); - } - - if (this._bluetooth) { - this.menu.addMenuItem(this._bluetooth.menu); - } - - this.menu.addMenuItem(this._power.menu); - this._power._sync(); - - if (this._nightLight) { - this.menu.addMenuItem(this._nightLight.menu); - } - - this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - this.menu.addMenuItem(this._system.menu); - - menuLayout.addSizeChild(this._power.menu.actor); - menuLayout.addSizeChild(this._system.menu.actor); - } -}); +}); \ No newline at end of file diff --git a/panelManager.js b/panelManager.js index 8468128..b824ccb 100755 --- a/panelManager.js +++ b/panelManager.js @@ -35,7 +35,6 @@ const Proximity = Me.imports.proximity; const Taskbar = Me.imports.taskbar; const Utils = Me.imports.utils; -const Config = imports.misc.config; const Gi = imports._gi; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; @@ -62,11 +61,6 @@ var PanelManager = class { this.panelsElementPositions = {}; this._saveMonitors(); - - Utils.getAppDisplayViews().forEach(v => { - Utils.wrapActor(v.view); - Utils.wrapActor(v.view._grid); - }); } enable(reset) { @@ -75,11 +69,6 @@ var PanelManager = class { this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex] || Main.layoutManager.primaryMonitor; this.proximityManager = new Proximity.ProximityManager(); - this._oldGetShowAppsButton = imports.ui.main.overview.dash.showAppsButton; - - Utils.wrapActor(Main.panel); - Utils.wrapActor(Main.overview.dash || 0); - this.primaryPanel = this._createPanel(this.dtpPrimaryMonitor, Me.settings.get_boolean('stockgs-keep-top-panel')); this.allPanels = [ this.primaryPanel ]; @@ -233,8 +222,8 @@ var PanelManager = class { p.panelBox.destroy(); } else { p.panelBox.remove_child(p); - p.remove_child(p.panel.actor); - p.panelBox.add(p.panel.actor); + p.remove_child(p.panel); + p.panelBox.add(p.panel); p.panelBox.set_position(clipContainer.x, clipContainer.y); @@ -370,7 +359,7 @@ var PanelManager = class { } else { panelBox = Main.layoutManager.panelBox; Main.layoutManager._untrackActor(panelBox); - panelBox.remove_child(Main.panel.actor); + panelBox.remove_child(Main.panel); Main.layoutManager.removeChrome(panelBox); } @@ -404,9 +393,8 @@ var PanelManager = class { _adjustPanelMenuButton(button, monitor, arrowSide) { if (button) { - Utils.wrapActor(button); button.menu._boxPointer._dtpSourceActor = button.menu._boxPointer.sourceActor; - button.menu._boxPointer.sourceActor = button.actor; + button.menu._boxPointer.sourceActor = button; button.menu._boxPointer._userArrowSide = arrowSide; button.menu._boxPointer._dtpInPanel = 1; @@ -722,14 +710,12 @@ function _newLookingGlassResize() { let topOffset = primaryMonitorPanel.getPosition() == St.Side.TOP ? primaryMonitorPanel.dtpSize + 8 : 32; this._oldResize(); - Utils.wrapActor(this); - Utils.wrapActor(this._objInspector); - this._hiddenY = Main.layoutManager.primaryMonitor.y + topOffset - this.actor.height; - this._targetY = this._hiddenY + this.actor.height; - this.actor.y = this._hiddenY; + this._hiddenY = Main.layoutManager.primaryMonitor.y + topOffset - this.height; + this._targetY = this._hiddenY + this.height; + this.y = this._hiddenY; - this._objInspector.actor.set_position(this.actor.x + Math.floor(this.actor.width * 0.1), this._targetY + Math.floor(this.actor.height * 0.1)); + this._objInspector.set_position(this.x + Math.floor(this.width * 0.1), this._targetY + Math.floor(this.height * 0.1)); } function _newLookingGlassOpen() { diff --git a/panelStyle.js b/panelStyle.js index 626e493..5e61311 100644 --- a/panelStyle.js +++ b/panelStyle.js @@ -301,7 +301,7 @@ var PanelStyle = class { } _refreshPanelButton(actor) { - if (actor.visible && imports.misc.config.PACKAGE_VERSION >= '3.34.0') { + if (actor.visible) { //force gnome 3.34+ to refresh (having problem with the -natural-hpadding) let parent = actor.get_parent(); let children = parent.get_children(); diff --git a/prefs.js b/prefs.js index 0c36a8a..81607a6 100644 --- a/prefs.js +++ b/prefs.js @@ -27,7 +27,6 @@ const GObject = imports.gi.GObject; const Gtk = imports.gi.Gtk; const Gdk = imports.gi.Gdk; const Mainloop = imports.mainloop; -const Config = imports.misc.config; const Me = imports.misc.extensionUtils.getCurrentExtension(); const Convenience = Me.imports.convenience; diff --git a/progress.js b/progress.js index 287dce3..45e26d2 100644 --- a/progress.js +++ b/progress.js @@ -287,7 +287,7 @@ var ProgressIndicator = class { this._progressManager = progressManager; this._signalsHandler = new Utils.GlobalSignalsHandler(); - this._sourceDestroyId = this._source.actor.connect('destroy', () => { + this._sourceDestroyId = this._source.connect('destroy', () => { this._signalsHandler.destroy(); }); @@ -321,7 +321,7 @@ var ProgressIndicator = class { } destroy() { - this._source.actor.disconnect(this._sourceDestroyId); + this._source.disconnect(this._sourceDestroyId); this._signalsHandler.destroy(); } diff --git a/taskbar.js b/taskbar.js index 6a163fb..0fa471c 100644 --- a/taskbar.js +++ b/taskbar.js @@ -23,7 +23,6 @@ const Clutter = imports.gi.Clutter; -const Config = imports.misc.config; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; @@ -124,8 +123,8 @@ var TaskbarActor = GObject.registerClass({ clip_to_allocation: true }); } - vfunc_allocate(box, flags) { - Utils.setAllocation(this, box, flags); + vfunc_allocate(box) { + this.set_allocation(box); let panel = this._delegate.dtpPanel; let availFixedSize = box[panel.fixedCoord.c2] - box[panel.fixedCoord.c1]; @@ -135,14 +134,14 @@ var TaskbarActor = GObject.registerClass({ let childBox = new Clutter.ActorBox(); let orientation = panel.getOrientation(); - Utils.allocate(dummy, childBox, flags); + dummy.allocate(childBox); childBox[panel.varCoord.c1] = box[panel.varCoord.c1]; childBox[panel.varCoord.c2] = Math.min(availVarSize, natSize); childBox[panel.fixedCoord.c1] = box[panel.fixedCoord.c1]; childBox[panel.fixedCoord.c2] = box[panel.fixedCoord.c2]; - Utils.allocate(scrollview, childBox, flags); + scrollview.allocate(childBox); let [value, , upper, , , pageSize] = scrollview[orientation[0] + 'scroll'].adjustment.get_values(); upper = Math.floor(upper); @@ -158,11 +157,11 @@ var TaskbarActor = GObject.registerClass({ } childBox[panel.varCoord.c2] = childBox[panel.varCoord.c1] + (value > 0 ? scrollview._dtpFadeSize : 0); - Utils.allocate(leftFade, childBox, flags); + leftFade.allocate(childBox); childBox[panel.varCoord.c1] = box[panel.varCoord.c2] - (value + pageSize < upper ? scrollview._dtpFadeSize : 0); childBox[panel.varCoord.c2] = box[panel.varCoord.c2]; - Utils.allocate(rightFade, childBox, flags); + rightFade.allocate(childBox); } // We want to request the natural size of all our children @@ -260,7 +259,7 @@ var Taskbar = class { let fade1 = new St.Widget({ style_class: 'scrollview-fade', reactive: false }); let fade2 = new St.Widget({ style_class: 'scrollview-fade', reactive: false, - pivot_point: Utils.getPoint({ x: .5, y: .5 }), + pivot_point: new imports.gi.Graphene.Point({ x: .5, y: .5 }), rotation_angle_z: 180 }); fade1.set_style(fadeStyle); @@ -285,16 +284,16 @@ var Taskbar = class { this._appSystem = Shell.AppSystem.get_default(); - this.iconAnimator = new PanelManager.IconAnimator(this.dtpPanel.panel.actor); + this.iconAnimator = new PanelManager.IconAnimator(this.dtpPanel.panel); this._signalsHandler.add( [ - this.dtpPanel.panel.actor, + this.dtpPanel.panel, 'notify::height', () => this._queueRedisplay() ], [ - this.dtpPanel.panel.actor, + this.dtpPanel.panel, 'notify::width', () => this._queueRedisplay() ], @@ -699,13 +698,13 @@ var Taskbar = class { if (appIcon._draggable) { appIcon._draggable.connect('drag-begin', () => { - appIcon.actor.opacity = 0; + appIcon.opacity = 0; appIcon.isDragged = 1; this._dropIconAnimations(); }); appIcon._draggable.connect('drag-end', () => { - appIcon.actor.opacity = 255; + appIcon.opacity = 255; delete appIcon.isDragged; this._updateAppIcons(); }); @@ -721,19 +720,19 @@ var Taskbar = class { item._dtpPanel = this.dtpPanel extendDashItemContainer(item); - item.setChild(appIcon.actor); + item.setChild(appIcon); appIcon._dashItemContainer = item; - appIcon.actor.connect('notify::hover', () => { - if (appIcon.actor.hover){ + appIcon.connect('notify::hover', () => { + if (appIcon.hover){ this._ensureAppIconVisibilityTimeoutId = Mainloop.timeout_add(100, () => { - Utils.ensureActorVisibleInScrollView(this._scrollView, appIcon.actor, this._scrollView._dtpFadeSize); + Utils.ensureActorVisibleInScrollView(this._scrollView, appIcon, this._scrollView._dtpFadeSize); this._ensureAppIconVisibilityTimeoutId = 0; return GLib.SOURCE_REMOVE; }); if (!appIcon.isDragged && iconAnimationSettings.type == 'SIMPLE') - appIcon.actor.get_parent().raise(1); + appIcon.get_parent().raise(1); else if (!appIcon.isDragged && (iconAnimationSettings.type == 'RIPPLE' || iconAnimationSettings.type == 'PLANK')) this._updateIconAnimations(); } else { @@ -743,16 +742,16 @@ var Taskbar = class { } if (!appIcon.isDragged && iconAnimationSettings.type == 'SIMPLE') - appIcon.actor.get_parent().raise(0); + appIcon.get_parent().raise(0); } }); - appIcon.actor.connect('clicked', + appIcon.connect('clicked', (actor) => { Utils.ensureActorVisibleInScrollView(this._scrollView, actor, this._scrollView._dtpFadeSize); }); - appIcon.actor.connect('key-focus-in', (actor) => { + appIcon.connect('key-focus-in', (actor) => { let [x_shift, y_shift] = Utils.ensureActorVisibleInScrollView(this._scrollView, actor, this._scrollView._dtpFadeSize); // This signal is triggered also by mouse click. The popup menu is opened at the original @@ -765,7 +764,7 @@ var Taskbar = class { // Override default AppIcon label_actor, now the // accessible_name is set at DashItemContainer.setLabelText - appIcon.actor.label_actor = null; + appIcon.label_actor = null; item.setLabelText(app.get_name()); appIcon.icon.setIconSize(this.iconSize); @@ -1123,10 +1122,9 @@ var Taskbar = class { if (!this._settings.is_writable('favorite-apps')) return DND.DragMotionResult.NO_DROP; - let sourceActor = source instanceof St.Widget ? source : source.actor; let isVertical = this.dtpPanel.checkIfVertical(); - if (!this._box.contains(sourceActor) && !source._dashItemContainer) { + if (!this._box.contains(source) && !source._dashItemContainer) { //not an appIcon of the taskbar, probably from the applications view source._dashItemContainer = new DragPlaceholderItem(source, this.iconSize, isVertical); this._box.insert_child_above(source._dashItemContainer, null); @@ -1358,11 +1356,11 @@ var TaskbarItemContainer = GObject.registerClass({ super._init() } - vfunc_allocate(box, flags) { + vfunc_allocate(box) { if (this.child == null) return; - Utils.setAllocation(this, box, flags); + this.set_allocation(box); let availWidth = box.x2 - box.x1; let availHeight = box.y2 - box.y1; @@ -1378,7 +1376,7 @@ var TaskbarItemContainer = GObject.registerClass({ childBox.x2 = childBox.x1 + childWidth; childBox.y2 = childBox.y1 + childHeight; - Utils.allocate(this.child, childBox, flags); + this.child.allocate(childBox); } // In case appIcon is removed from the taskbar while it is hovered, @@ -1405,13 +1403,10 @@ var TaskbarItemContainer = GObject.registerClass({ _updateCloneContainerPosition(cloneContainer) { let [stageX, stageY] = this.get_transformed_position(); - if (Config.PACKAGE_VERSION >= '3.36') { - cloneContainer.set_position( - stageX - this._dtpPanel.panelBox.translation_x - this.translation_x, - stageY - this._dtpPanel.panelBox.translation_y - this.translation_y - ); - } else - cloneContainer.set_position(stageX, stageY); + cloneContainer.set_position( + stageX - this._dtpPanel.panelBox.translation_x - this.translation_x, + stageY - this._dtpPanel.panelBox.translation_y - this.translation_y + ); } _createRaisedClone() { @@ -1430,13 +1425,9 @@ var TaskbarItemContainer = GObject.registerClass({ this._updateCloneContainerPosition(cloneContainer); // For the stretch animation - if (Config.PACKAGE_VERSION >= '3.36') { - let boundProperty = this._dtpPanel.checkIfVertical() ? 'translation_y' : 'translation_x'; - this.bind_property(boundProperty, cloneContainer, boundProperty, GObject.BindingFlags.SYNC_CREATE); - } else { - let constraint = new CloneContainerConstraint({ source: this }); - cloneContainer.add_constraint(constraint); - } + let boundProperty = this._dtpPanel.checkIfVertical() ? 'translation_y' : 'translation_x'; + this.bind_property(boundProperty, cloneContainer, boundProperty, GObject.BindingFlags.SYNC_CREATE); + // The clone follows its source when the taskbar is scrolled. let taskbarScrollView = this.get_parent().get_parent(); diff --git a/transparency.js b/transparency.js index fe32e0d..d7a5844 100644 --- a/transparency.js +++ b/transparency.js @@ -36,10 +36,10 @@ var DynamicTransparency = class { this._windowOverlap = false; this.currentBackgroundColor = 0; - this._initialPanelStyle = dtpPanel.panel.actor.get_style(); + this._initialPanelStyle = dtpPanel.panel.get_style(); if (Config.PACKAGE_VERSION < '42' && this._dtpPanel.geom.position == St.Side.TOP) { - this._initialPanelCornerStyle = dtpPanel.panel._leftCorner.actor.get_style(); + this._initialPanelCornerStyle = dtpPanel.panel._leftCorner.get_style(); } this._signalsHandler = new Utils.GlobalSignalsHandler(); @@ -54,11 +54,11 @@ var DynamicTransparency = class { this._signalsHandler.destroy(); this._proximityManager.removeWatch(this._proximityWatchId); - this._dtpPanel.panel.actor.set_style(this._initialPanelStyle); + this._dtpPanel.panel.set_style(this._initialPanelStyle); if (Config.PACKAGE_VERSION < '42' && this._dtpPanel.geom.position == St.Side.TOP) { - this._dtpPanel.panel._leftCorner.actor.set_style(this._initialPanelCornerStyle); - this._dtpPanel.panel._rightCorner.actor.set_style(this._initialPanelCornerStyle); + this._dtpPanel.panel._leftCorner.set_style(this._initialPanelCornerStyle); + this._dtpPanel.panel._rightCorner.set_style(this._initialPanelCornerStyle); } } @@ -181,7 +181,7 @@ var DynamicTransparency = class { } _updateComplementaryStyles() { - let panelThemeNode = this._dtpPanel.panel.actor.get_theme_node(); + let panelThemeNode = this._dtpPanel.panel.get_theme_node(); this._complementaryStyles = 'border-radius: ' + panelThemeNode.get_border_radius(0) + 'px;'; } @@ -223,13 +223,13 @@ var DynamicTransparency = class { if (Config.PACKAGE_VERSION < '42' && this._dtpPanel.geom.position == St.Side.TOP) { let cornerStyle = '-panel-corner-background-color: ' + this.currentBackgroundColor + transition; - this._dtpPanel.panel._leftCorner.actor.set_style(cornerStyle); - this._dtpPanel.panel._rightCorner.actor.set_style(cornerStyle); + this._dtpPanel.panel._leftCorner.set_style(cornerStyle); + this._dtpPanel.panel._rightCorner.set_style(cornerStyle); } } _setGradient() { - this._dtpPanel.panel.actor.set_style( + this._dtpPanel.panel.set_style( 'background: none; ' + 'border-image: none; ' + 'background-image: none; ' + diff --git a/utils.js b/utils.js index 6393667..e45a888 100644 --- a/utils.js +++ b/utils.js @@ -22,7 +22,6 @@ */ const Clutter = imports.gi.Clutter; -const Config = imports.misc.config; const GdkPixbuf = imports.gi.GdkPixbuf; const Gi = imports._gi; const Gio = imports.gi.Gio; @@ -39,12 +38,6 @@ const Util = imports.misc.util; var TRANSLATION_DOMAIN = imports.misc.extensionUtils.getCurrentExtension().metadata['gettext-domain']; var SCROLL_TIME = Util.SCROLL_TIME / (Util.SCROLL_TIME > 1 ? 1000 : 1); -//Clutter implicit animations are available since 3.34 -//prefer those over Tweener if available -if (Config.PACKAGE_VERSION < '3.34') { - var Tweener = imports.ui.tweener; -} - // simplify global signals and function injections handling // abstract class var BasicHandler = class { @@ -234,11 +227,6 @@ var getScaleFactor = function() { return getStageTheme().scale_factor || 1; }; -var getAppDisplayViews = function() { - //gnome-shell 3.38 only has one view and it is now the appDisplay - return imports.ui.appDisplay._views || [{ view: imports.ui.appDisplay }]; -}; - var findIndex = function(array, predicate) { if (array) { if (Array.prototype.findIndex) { @@ -283,14 +271,6 @@ var hookVfunc = function(proto, symbol, func) { } }; -var wrapActor = function(actor) { - if (actor) { - Object.defineProperty(actor, 'actor', { - value: actor instanceof Clutter.Actor ? actor : actor.actor - }); - } -}; - var getTrackedActorData = (actor) => { let trackedIndex = Main.layoutManager._findActor(actor); @@ -299,10 +279,6 @@ var getTrackedActorData = (actor) => { } var getTransformedAllocation = function(actor) { - if (Config.PACKAGE_VERSION < '3.37') { - return Shell.util_get_transformed_allocation(actor); - } - let extents = actor.get_transformed_extents(); let topLeft = extents.get_top_left(); let bottomRight = extents.get_bottom_right(); @@ -310,26 +286,6 @@ var getTransformedAllocation = function(actor) { return { x1: topLeft.x, x2: bottomRight.x, y1: topLeft.y, y2: bottomRight.y }; }; -var allocate = function(actor, box, flags, useParent) { - let allocateObj = useParent ? Object.getPrototypeOf(actor) : actor; - - allocateObj.allocate.apply(actor, getAllocationParams(box, flags)); -}; - -var setAllocation = function(actor, box, flags) { - actor.set_allocation.apply(actor, getAllocationParams(box, flags)); -}; - -var getAllocationParams = function(box, flags) { - let params = [box]; - - if (Config.PACKAGE_VERSION < '3.37') { - params.push(flags); - } - - return params; -}; - var setClip = function(actor, x, y, width, height) { actor.set_clip(0, 0, width, height); actor.set_position(x, y); @@ -433,45 +389,35 @@ var animateWindowOpacity = function(window, tweenOpts, adjustVisibility) { //there currently is a mutter bug with the windowactor opacity, starting with 3.34 //https://gitlab.gnome.org/GNOME/mutter/issues/836 - if (Config.PACKAGE_VERSION > '3.35') { - //on 3.36, a workaround is to use the windowactor's child for the fade animation - //this leaves a "shadow" on the desktop, so the windowactor needs to be hidden - //when the animation is complete - let visible = tweenOpts.opacity > 0; - let windowActor = window; + //since 3.36, a workaround is to use the windowactor's child for the fade animation + //this leaves a "shadow" on the desktop, so the windowactor needs to be hidden + //when the animation is complete + let visible = tweenOpts.opacity > 0; + let windowActor = window; - window = windowActor.get_first_child() || windowActor; + window = windowActor.get_first_child() || windowActor; - if (!windowActor.visible && visible && adjustVisibility) { - window.opacity = 0; - windowActor.visible = visible; - } - - if (!visible) { - let initialOpacity = window.opacity; + if (!windowActor.visible && visible && adjustVisibility) { + window.opacity = 0; + windowActor.visible = visible; + } + + if (!visible) { + let initialOpacity = window.opacity; - tweenOpts.onComplete = () => { - windowActor.visible = visible; - window.opacity = initialOpacity; - }; - } - } else if (Config.PACKAGE_VERSION > '3.33') { - //the workaround only works on 3.35+, so on 3.34, let's just hide the - //window without animation - return window.visible = (tweenOpts.opacity == 255); + tweenOpts.onComplete = () => { + windowActor.visible = visible; + window.opacity = initialOpacity; + }; } animate(window, tweenOpts); }; var animate = function(actor, options) { - if (Tweener) { - return Tweener.addTween(actor, options); - } - - //to support both Tweener and Clutter animations, we use Tweener "time" - //and "delay" properties defined in seconds, as opposed to Clutter animations - //"duration" and "delay" which are defined in milliseconds + //the original animations used Tweener instead of Clutter animations, so we + //use "time" and "delay" properties defined in seconds, as opposed to Clutter + //animations duration" and "delay" which are defined in milliseconds if (options.delay) { options.delay = options.delay * 1000; } @@ -502,18 +448,10 @@ var animate = function(actor, options) { } var isAnimating = function(actor, prop) { - if (Tweener) { - return Tweener.isTweening(actor); - } - return !!actor.get_transition(prop); } var stopAnimations = function(actor) { - if (Tweener) { - return Tweener.removeTweens(actor); - } - actor.remove_all_transitions(); } @@ -526,11 +464,7 @@ var getIndicators = function(delegate) { } var getPoint = function(coords) { - if (Config.PACKAGE_VERSION > '3.35.1') { - return new imports.gi.Graphene.Point(coords); - } - - return new Clutter.Point(coords); + return new imports.gi.Graphene.Point(coords); } var notify = function(text, iconName, action, isTransient) { diff --git a/windowPreview.js b/windowPreview.js index 05f5404..d0f4768 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -17,8 +17,8 @@ const GObject = imports.gi.GObject; const Clutter = imports.gi.Clutter; -const Config = imports.misc.config; const GLib = imports.gi.GLib; +const Graphene = imports.gi.Graphene; const Gtk = imports.gi.Gtk; const Main = imports.ui.main; const Mainloop = imports.mainloop; @@ -463,9 +463,9 @@ var PreviewMenu = GObject.registerClass({ } _updatePosition() { - let sourceNode = this.currentAppIcon.actor.get_theme_node(); - let sourceContentBox = sourceNode.get_content_box(this.currentAppIcon.actor.get_allocation_box()); - let sourceAllocation = Utils.getTransformedAllocation(this.currentAppIcon.actor); + let sourceNode = this.currentAppIcon.get_theme_node(); + let sourceContentBox = sourceNode.get_content_box(this.currentAppIcon.get_allocation_box()); + let sourceAllocation = Utils.getTransformedAllocation(this.currentAppIcon); let [previewsWidth, previewsHeight] = this._getPreviewsSize(); let appIconMargin = Me.settings.get_int('appicon-margin') / scaleFactor; let x = 0, y = 0; @@ -535,7 +535,7 @@ var PreviewMenu = GObject.registerClass({ let fadeWidget = new St.Widget({ reactive: false, - pivot_point: Utils.getPoint({ x: .5, y: .5 }), + pivot_point: new Graphene.Point({ x: .5, y: .5 }), rotation_angle_z: end ? 180 : 0, style: fadeStyle, x: x, y: y, @@ -717,9 +717,7 @@ var Preview = GObject.registerClass({ let [previewBinWidth, previewBinHeight] = this._getBinSize(); let closeButton = new St.Button({ style_class: 'window-close', accessible_name: 'Close window' }); - if (Config.PACKAGE_VERSION >= '3.31.9') { - closeButton.add_actor(new St.Icon({ icon_name: 'window-close-symbolic' })); - } + closeButton.add_actor(new St.Icon({ icon_name: 'window-close-symbolic' })); this._closeButtonBin = new St.Widget({ style_class: 'preview-close-btn-container', @@ -1123,7 +1121,7 @@ var WindowCloneLayout = GObject.registerClass({ this.bufferRect = bufferRect; } - vfunc_allocate(actor, box, flags) { + vfunc_allocate(actor, box) { let [width, height] = box.get_size(); box.set_origin( @@ -1136,7 +1134,7 @@ var WindowCloneLayout = GObject.registerClass({ height + (this.bufferRect.height - this.frameRect.height) * this.ratio ); - Utils.allocate(actor.get_first_child(), box, flags); + actor.get_first_child().allocate(box); } });