Bump to version 56.9

This commit is contained in:
Artyom Zorin
2024-09-03 14:08:20 +01:00
parent 16011c0aec
commit 2a447787a5
65 changed files with 32553 additions and 20556 deletions
Executable → Regular
+195 -367
View File
@@ -28,17 +28,17 @@
*/
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Overview = Me.imports.overview;
const Panel = Me.imports.panel;
const Pos = Me.imports.panelPositions;
const { Overview } = Me.imports.overview;
const { Panel, panelBoxes } = Me.imports.panel;
const PanelSettings = Me.imports.panelSettings;
const Proximity = Me.imports.proximity;
const Taskbar = Me.imports.taskbar;
const Utils = Me.imports.utils;
const DesktopIconsIntegration = Me.imports.desktopIconsIntegration;
const Config = imports.misc.config;
const Lang = imports.lang;
const Gi = imports._gi;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Clutter = imports.gi.Clutter;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
@@ -53,35 +53,29 @@ const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const Layout = imports.ui.layout;
const WM = imports.ui.windowManager;
const WorkspacesView = imports.ui.workspacesView;
const { SecondaryMonitorDisplay, WorkspacesView } = imports.ui.workspacesView;
var dtpPanelManager = Utils.defineClass({
Name: 'ZorinTaskbar.PanelManager',
var PanelManager = class {
_init: function() {
this.overview = new Overview.dtpOverview();
constructor() {
this.overview = new Overview();
this.panelsElementPositions = {};
this._saveMonitors();
}
Utils.getAppDisplayViews().forEach(v => {
Utils.wrapActor(v.view);
Utils.wrapActor(v.view._grid);
});
},
enable: function(reset) {
this.panelPositions = Pos.getSettingsPositions(Me.settings, 'panel-positions');
enable(reset) {
this.allPanels = [];
this.dtpPrimaryMonitor = Main.layoutManager.primaryMonitor; // The real primary monitor should always have the main panel
this.proximityManager = new Proximity.ProximityManager();
Utils.wrapActor(Main.panel);
Utils.wrapActor(Main.overview.dash || 0);
if (this.dtpPrimaryMonitor) {
this.primaryPanel = this._createPanel(this.dtpPrimaryMonitor, Me.settings.get_boolean('stockgs-keep-top-panel'));
this.allPanels.push(this.primaryPanel);
this.overview.enable(this.primaryPanel);
this.primaryPanel = this._createPanel(this.dtpPrimaryMonitor, false);
this.allPanels = [ this.primaryPanel ];
this.overview.enable(this.primaryPanel);
this.setFocusedMonitor(this.dtpPrimaryMonitor);
}
if (Me.settings.get_boolean('multi-monitors')) {
Main.layoutManager.monitors.filter(m => m != this.dtpPrimaryMonitor).forEach(m => {
@@ -106,6 +100,7 @@ var dtpPanelManager = Utils.defineClass({
p.taskbar.iconAnimator.start();
});
this._setDesktopIconsMargins();
//in 3.32, BoxPointer now inherits St.Widget
if (BoxPointer.BoxPointer.prototype.vfunc_get_preferred_height) {
let panelManager = this;
@@ -120,23 +115,10 @@ var dtpPanelManager = Utils.defineClass({
}
this._updatePanelElementPositions();
this.setFocusedMonitor(this.dtpPrimaryMonitor);
if (this.primaryPanel.checkIfVertical()) {
Main.wm._getPositionForDirection = newGetPositionForDirection;
}
if (reset) return;
this._oldViewSelectorAnimateIn = Main.overview.viewSelector._animateIn;
Main.overview.viewSelector._animateIn = Lang.bind(this.primaryPanel, newViewSelectorAnimateIn);
this._oldViewSelectorAnimateOut = Main.overview.viewSelector._animateOut;
Main.overview.viewSelector._animateOut = Lang.bind(this.primaryPanel, newViewSelectorAnimateOut);
if (Config.PACKAGE_VERSION > '3.35.1') {
this._oldDoSpringAnimation = AppDisplay.BaseAppView.prototype._doSpringAnimation;
AppDisplay.BaseAppView.prototype._doSpringAnimation = newDoSpringAnimation;
}
this._desktopIconsUsableArea = new DesktopIconsIntegration.DesktopIconsUsableAreaClass();
this._oldUpdatePanelBarrier = Main.layoutManager._updatePanelBarrier;
Main.layoutManager._updatePanelBarrier = (panel) => {
@@ -147,32 +129,18 @@ var dtpPanelManager = Utils.defineClass({
Main.layoutManager._updatePanelBarrier();
this._oldUpdateHotCorners = Main.layoutManager._updateHotCorners;
Main.layoutManager._updateHotCorners = Lang.bind(Main.layoutManager, newUpdateHotCorners);
Main.layoutManager._updateHotCorners = newUpdateHotCorners.bind(Main.layoutManager);
Main.layoutManager._updateHotCorners();
if (Main.layoutManager._interfaceSettings) {
this._enableHotCornersId = Main.layoutManager._interfaceSettings.connect('changed::enable-hot-corners', () => Main.layoutManager._updateHotCorners());
}
this._oldOverviewRelayout = Main.overview._relayout;
Main.overview._relayout = Lang.bind(Main.overview, this._newOverviewRelayout);
this._oldUpdateWorkspacesViews = Main.overview._overview._controls._workspacesDisplay._updateWorkspacesViews;
Main.overview._overview._controls._workspacesDisplay._updateWorkspacesViews = this._newUpdateWorkspacesViews.bind(Main.overview._overview._controls._workspacesDisplay);
this._oldUpdateWorkspacesViews = Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews;
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = Lang.bind(Main.overview.viewSelector._workspacesDisplay, this._newUpdateWorkspacesViews);
this._oldGetShowAppsButton = Main.overview.getShowAppsButton;
Main.overview.getShowAppsButton = this._newGetShowAppsButton.bind(this);
this._needsDashItemContainerAllocate = !Dash.DashItemContainer.prototype.hasOwnProperty('vfunc_allocate');
if (this._needsDashItemContainerAllocate) {
Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', this._newDashItemContainerAllocate);
}
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
//animate a null target since some variables are not initialized when the viewSelector is created
if(Main.overview.viewSelector._activePage == null)
Main.overview.viewSelector._activePage = Main.overview.viewSelector._workspacesPage;
this._oldSetPrimaryWorkspaceVisible = Main.overview._overview._controls._workspacesDisplay.setPrimaryWorkspaceVisible
Main.overview._overview._controls._workspacesDisplay.setPrimaryWorkspaceVisible = this._newSetPrimaryWorkspaceVisible.bind(Main.overview._overview._controls._workspacesDisplay);
LookingGlass.LookingGlass.prototype._oldResize = LookingGlass.LookingGlass.prototype._resize;
LookingGlass.LookingGlass.prototype._resize = _newLookingGlassResize;
@@ -182,53 +150,6 @@ var dtpPanelManager = Utils.defineClass({
this._signalsHandler = new Utils.GlobalSignalsHandler();
if (Config.PACKAGE_VERSION > '3.35.9') {
let currentAppsView;
this._oldAnimateIconPosition = IconGrid.animateIconPosition;
IconGrid.animateIconPosition = newAnimateIconPosition.bind(this);
this._signalsHandler.add(
[
Utils.DisplayWrapper.getScreen(),
'window-entered-monitor',
() => this._needsIconAllocate = 1
]
);
Utils.getAppDisplayViews().forEach(v => {
if (!v.control || v.control.has_style_pseudo_class('checked')) {
currentAppsView = v;
}
if (v.control) {
this._signalsHandler.add(
[
v.control,
'clicked',
() => {
this._needsIconAllocate = currentAppsView != v;
currentAppsView = v;
}
]
);
}
this._signalsHandler.add(
[
v.view,
'notify::visible',
() => this._needsIconAllocate = !(currentAppsView != v && !v.view.visible)
],
[
v.view._grid,
'animation-done',
() => this._needsIconAllocate = 0
]
);
});
}
//listen settings
this._signalsHandler.add(
[
@@ -236,7 +157,10 @@ var dtpPanelManager = Utils.defineClass({
[
'changed::multi-monitors',
'changed::isolate-monitors',
'changed::panel-positions'
'changed::panel-positions',
'changed::panel-lengths',
'changed::panel-anchors',
'changed::stockgs-keep-top-panel'
],
() => this._reset()
],
@@ -250,6 +174,16 @@ var dtpPanelManager = Utils.defineClass({
'changed::intellihide-key-toggle-text',
() => this._setKeyBindings(true)
],
[
Me.settings,
'changed::panel-sizes',
() => {
GLib.idle_add(GLib.PRIORITY_LOW, () => {
this._setDesktopIconsMargins();
return GLib.SOURCE_REMOVE;
});
}
],
[
Utils.DisplayWrapper.getMonitorManager(),
'monitors-changed',
@@ -262,20 +196,30 @@ var dtpPanelManager = Utils.defineClass({
]
);
Panel.panelBoxes.forEach(c => this._signalsHandler.add(
[Main.panel[c], 'actor-added', (parent, child) => this._adjustPanelMenuButton(this._getPanelMenuButton(child), this.primaryPanel.monitor, this.primaryPanel.getPosition())]
panelBoxes.forEach(c => this._signalsHandler.add(
[
Main.panel[c],
'actor-added',
(parent, child) =>
this.primaryPanel &&
this._adjustPanelMenuButton(this._getPanelMenuButton(child), this.primaryPanel.monitor, this.primaryPanel.getPosition())
]
));
this._setKeyBindings(true);
},
disable: function(reset) {
this.overview.disable();
// keep GS overview.js from blowing away custom panel styles
if(!Me.settings.get_boolean('stockgs-keep-top-panel'))
Object.defineProperty(Main.panel, "style", {configurable: true, set(v) {}});
}
disable(reset) {
this.primaryPanel && this.overview.disable();
this.proximityManager.destroy();
this.allPanels.forEach(p => {
p.taskbar.iconAnimator.pause();
this._findPanelMenuButtons(p.panelBox).forEach(pmb => {
if (pmb.menu._boxPointer._dtpGetPreferredHeightId) {
pmb.menu._boxPointer._container.disconnect(pmb.menu._boxPointer._dtpGetPreferredHeightId);
@@ -299,8 +243,8 @@ var dtpPanelManager = Utils.defineClass({
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);
@@ -313,8 +257,6 @@ var dtpPanelManager = Utils.defineClass({
Utils.hookVfunc(BoxPointer.BoxPointer.prototype, 'get_preferred_height', BoxPointer.BoxPointer.prototype.vfunc_get_preferred_height);
}
delete Main.wm._getPositionForDirection;
if (Main.layoutManager.primaryMonitor) {
Main.layoutManager.panelBox.set_position(Main.layoutManager.primaryMonitor.x, Main.layoutManager.primaryMonitor.y);
Main.layoutManager.panelBox.set_size(Main.layoutManager.primaryMonitor.width, -1);
@@ -336,67 +278,115 @@ var dtpPanelManager = Utils.defineClass({
Main.layoutManager._updatePanelBarrier = this._oldUpdatePanelBarrier;
Main.layoutManager._updatePanelBarrier();
Main.overview.viewSelector._animateIn = this._oldViewSelectorAnimateIn;
Main.overview.viewSelector._animateOut = this._oldViewSelectorAnimateOut;
Main.overview._relayout = this._oldOverviewRelayout;
Main.overview._relayout();
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = this._oldUpdateWorkspacesViews;
Utils.getPanelGhost().set_size(-1, -1);
if (this._needsDashItemContainerAllocate) {
Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', function(box, flags) { this.vfunc_allocate(box, flags); });
}
if (this._oldDoSpringAnimation) {
AppDisplay.BaseAppView.prototype._doSpringAnimation = this._oldDoSpringAnimation;
}
if (this._oldAnimateIconPosition) {
IconGrid.animateIconPosition = this._oldAnimateIconPosition;
}
Main.overview._overview._controls._workspacesDisplay._updateWorkspacesViews = this._oldUpdateWorkspacesViews;
Main.overview._overview._controls._workspacesDisplay.setPrimaryWorkspaceVisible = this._oldSetPrimaryWorkspaceVisible;
LookingGlass.LookingGlass.prototype._resize = LookingGlass.LookingGlass.prototype._oldResize;
delete LookingGlass.LookingGlass.prototype._oldResize;
LookingGlass.LookingGlass.prototype.open = LookingGlass.LookingGlass.prototype._oldOpen;
delete LookingGlass.LookingGlass.prototype._oldOpen
},
setFocusedMonitor: function(monitor, ignoreRelayout) {
this._needsIconAllocate = 1;
delete Main.panel.style;
this._desktopIconsUsableArea.destroy();
this._desktopIconsUsableArea = null;
}
_setDesktopIconsMargins() {
this._desktopIconsUsableArea?.resetMargins();
this.allPanels.forEach(p => {
switch(p.geom.position) {
case St.Side.TOP:
this._desktopIconsUsableArea?.setMargins(p.monitor.index, p.geom.h, 0, 0, 0);
break;
case St.Side.BOTTOM:
this._desktopIconsUsableArea?.setMargins(p.monitor.index, 0, p.geom.h, 0, 0);
break;
case St.Side.LEFT:
this._desktopIconsUsableArea?.setMargins(p.monitor.index, 0, 0, p.geom.w, 0);
break;
case St.Side.RIGHT:
this._desktopIconsUsableArea?.setMargins(p.monitor.index, 0, 0, 0, p.geom.w);
break;
}
});
}
setFocusedMonitor(monitor) {
this.focusedMonitorPanel = this.allPanels.find(p => p.monitor == monitor)
if (!this.checkIfFocusedMonitor(monitor)) {
Main.overview.viewSelector._workspacesDisplay._primaryIndex = monitor.index;
Main.overview._overview.clear_constraints();
Main.overview._overview.add_constraint(new Layout.MonitorConstraint({ index: monitor.index }));
if (ignoreRelayout) return;
this._newOverviewRelayout.call(Main.overview);
Main.overview._overview._controls._workspacesDisplay._primaryIndex = monitor.index;
}
},
}
_saveMonitors: function() {
_newSetPrimaryWorkspaceVisible(visible) {
if (this._primaryVisible === visible)
return;
this._primaryVisible = visible;
const primaryIndex = Main.overview._overview._controls._workspacesDisplay._primaryIndex;
const primaryWorkspace = this._workspacesViews[primaryIndex];
if (primaryWorkspace)
primaryWorkspace.visible = visible;
}
_newUpdateWorkspacesViews() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].destroy();
this._workspacesViews = [];
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
let view;
if (i === this._primaryIndex) {
view = new WorkspacesView(i,
this._controls,
this._scrollAdjustment,
this._fitModeAdjustment,
this._overviewAdjustment);
view.visible = this._primaryVisible;
this.bind_property('opacity', view, 'opacity', GObject.BindingFlags.SYNC_CREATE);
this.add_child(view);
} else {
// No idea why atm, but we need the import at the top of this file and to use the
// full imports ns here, otherwise SecondaryMonitorDisplay can't be used ¯\_(ツ)_/¯
view = new imports.ui.workspacesView.SecondaryMonitorDisplay(i,
this._controls,
this._scrollAdjustment,
this._fitModeAdjustment,
this._overviewAdjustment);
Main.layoutManager.overviewGroup.add_actor(view);
}
this._workspacesViews.push(view);
}
}
_saveMonitors() {
//Mutter meta_monitor_manager_get_primary_monitor (global.display.get_primary_monitor()) doesn't return the same
//monitor as GDK gdk_screen_get_primary_monitor (imports.gi.Gdk.Screen.get_default().get_primary_monitor()).
//Since the Mutter function is what's used in gnome-shell and we can't access it from the settings dialog, store
//the monitors information in a setting so we can use the same monitor indexes as the ones in gnome-shell
let keyMonitors = 'available-monitors';
let primaryIndex = Main.layoutManager.primaryIndex;
let monitors = [primaryIndex];
let newMonitors = [primaryIndex];
Main.layoutManager.monitors.filter(m => m.index != primaryIndex).forEach(m => monitors.push(m.index));
Me.settings.set_value('available-monitors', new GLib.Variant('ai', monitors));
},
Main.layoutManager.monitors.filter(m => m.index != primaryIndex).forEach(m => newMonitors.push(m.index));
Me.settings.set_value(keyMonitors, new GLib.Variant('ai', newMonitors));
}
checkIfFocusedMonitor: function(monitor) {
return Main.overview.viewSelector._workspacesDisplay._primaryIndex == monitor.index;
},
checkIfFocusedMonitor(monitor) {
return Main.overview._overview._controls._workspacesDisplay._primaryIndex == monitor.index;
}
_createPanel: function(monitor, isStandalone) {
_createPanel(monitor, isStandalone) {
let panelBox;
let panel;
let clipContainer = new Clutter.Actor();
@@ -406,7 +396,7 @@ var dtpPanelManager = Utils.defineClass({
} else {
panelBox = Main.layoutManager.panelBox;
Main.layoutManager._untrackActor(panelBox);
panelBox.remove_child(Main.panel.actor);
panelBox.remove_child(Main.panel);
Main.layoutManager.removeChrome(panelBox);
}
@@ -414,7 +404,7 @@ var dtpPanelManager = Utils.defineClass({
clipContainer.add_child(panelBox);
Main.layoutManager.trackChrome(panelBox, { trackFullscreen: true, affectsStruts: true, affectsInputRegion: true });
panel = new Panel.dtpPanel(this, monitor, panelBox, isStandalone);
panel = new Panel(this, monitor, panelBox, isStandalone);
panelBox.add(panel);
panel.enable();
@@ -425,24 +415,23 @@ var dtpPanelManager = Utils.defineClass({
panelBox.set_position(0, 0);
return panel;
},
}
_reset: function() {
_reset() {
this.disable(true);
this.allPanels = [];
this.enable(true);
},
}
_updatePanelElementPositions: function() {
this.panelsElementPositions = Pos.getSettingsPositions(Me.settings, 'panel-element-positions');
_updatePanelElementPositions() {
this.panelsElementPositions = PanelSettings.getSettingsJson(Me.settings, 'panel-element-positions');
this.allPanels.forEach(p => p.updateElementPositions());
},
}
_adjustPanelMenuButton: function(button, monitor, arrowSide) {
_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;
@@ -452,9 +441,9 @@ var dtpPanelManager = Utils.defineClass({
});
}
}
},
}
_getBoxPointerPreferredHeight: function(boxPointer, alloc, monitor) {
_getBoxPointerPreferredHeight(boxPointer, alloc, monitor) {
if (boxPointer._dtpInPanel && boxPointer.sourceActor && Me.settings.get_boolean('intellihide')) {
monitor = monitor || Main.layoutManager.findMonitorForActor(boxPointer.sourceActor);
let panel = Utils.find(global.zorinTaskbar.panels, p => p.monitor == monitor);
@@ -466,9 +455,9 @@ var dtpPanelManager = Utils.defineClass({
}
return [alloc.min_size, alloc.natural_size];
},
}
_findPanelMenuButtons: function(container) {
_findPanelMenuButtons(container) {
let panelMenuButtons = [];
let panelMenuButton;
@@ -483,9 +472,9 @@ var dtpPanelManager = Utils.defineClass({
find(container);
return panelMenuButtons;
},
}
_removePanelBarriers: function(panel) {
_removePanelBarriers(panel) {
if (panel.isStandalone && panel._rightPanelBarrier) {
panel._rightPanelBarrier.destroy();
}
@@ -494,13 +483,13 @@ var dtpPanelManager = Utils.defineClass({
panel._leftPanelBarrier.destroy();
delete panel._leftPanelBarrier;
}
},
}
_getPanelMenuButton: function(obj) {
return obj._delegate && obj._delegate instanceof PanelMenu.Button ? obj._delegate : 0;
},
_getPanelMenuButton(obj) {
return obj instanceof PanelMenu.Button && obj.menu?._boxPointer ? obj : 0;
}
_setKeyBindings: function(enable) {
_setKeyBindings(enable) {
let keys = {
'intellihide-key-toggle': () => this.allPanels.forEach(p => p.intellihide.toggle())
};
@@ -512,104 +501,15 @@ var dtpPanelManager = Utils.defineClass({
Utils.addKeybinding(k, Me.settings, keys[k], Shell.ActionMode.NORMAL);
}
});
},
}
_newOverviewRelayout: function() {
// To avoid updating the position and size of the workspaces
// we just hide the overview. The positions will be updated
// when it is next shown.
this.hide();
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.overview.viewSelector._workspacesDisplay._primaryIndex);
this._coverPane.set_position(0, workArea.y);
this._coverPane.set_size(workArea.width, workArea.height);
this._updateBackgrounds();
},
_newUpdateWorkspacesViews: function() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].destroy();
this._workspacesViews = [];
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
let workspaces;
let view;
if (this._workspacesOnlyOnPrimary && i != Main.layoutManager.primaryIndex) {
view = new WorkspacesView.ExtraWorkspaceView(i);
view.getActiveWorkspace = view.getActiveWorkspace || function() { return this._workspace; };
workspaces = [view._workspace];
} else {
view = new WorkspacesView.WorkspacesView(i, this._scrollAdjustment || 0);
workspaces = view._workspaces;
}
Utils.wrapActor(view);
view.actor.connect('scroll-event', this._onScrollEvent.bind(this));
if (i == Main.layoutManager.primaryIndex && view.scrollAdjustment) {
this._scrollAdjustment = view.scrollAdjustment;
this._scrollAdjustment.connect('notify::value',
this._scrollValueChanged.bind(this));
}
workspaces.forEach(w => w.setFullGeometry = geom => w._fullGeometry = geom);
this._workspacesViews.push(view);
}
this._workspacesViews.forEach(wv => Main.layoutManager.overviewGroup.add_actor(wv.actor));
if (this._syncWorkspacesFullGeometry) {
//gnome-shell 3.36.4
if (this._fullGeometry)
this._syncWorkspacesFullGeometry();
if (this._actualGeometry)
this._syncWorkspacesActualGeometry();
} else if (this._updateWorkspacesFullGeometry) {
this._updateWorkspacesFullGeometry();
this._updateWorkspacesActualGeometry();
}
},
_newGetShowAppsButton: function() {
let focusedMonitorIndex = Utils.findIndex(this.allPanels, p => this.checkIfFocusedMonitor(p.monitor));
return this.allPanels[focusedMonitorIndex].taskbar.showAppsButton;
},
_newDashItemContainerAllocate: function(box, flags) {
if (this.child == null)
return;
Utils.setAllocation(this, box, flags);
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
let [minChildWidth, minChildHeight, natChildWidth, natChildHeight] = this.child.get_preferred_size();
let [childScaleX, childScaleY] = this.child.get_scale();
let childWidth = Math.min(natChildWidth * childScaleX, availWidth);
let childHeight = Math.min(natChildHeight * childScaleY, availHeight);
let childBox = new Clutter.ActorBox();
childBox.x1 = (availWidth - childWidth) / 2;
childBox.y1 = (availHeight - childHeight) / 2;
childBox.x2 = childBox.x1 + childWidth;
childBox.y2 = childBox.y1 + childHeight;
Utils.allocate(this.child, childBox, flags);
},
});
};
// This class drives long-running icon animations, to keep them running in sync
// with each other.
var IconAnimator = Utils.defineClass({
Name: 'ZorinTaskbar.IconAnimator',
var IconAnimator = class {
_init: function(actor) {
constructor(actor) {
this._count = 0;
this._started = false;
this._animations = {
@@ -632,12 +532,12 @@ var IconAnimator = Utils.defineClass({
dancers[i].target.rotation_angle_z = danceRotation;
}
});
},
}
destroy: function() {
destroy() {
this._timeline.stop();
this._timeline = null;
for (const name in this._animations) {
for (let name in this._animations) {
const pairs = this._animations[name];
for (let i = 0, iMax = pairs.length; i < iMax; i++) {
const pair = pairs[i];
@@ -645,32 +545,32 @@ var IconAnimator = Utils.defineClass({
}
}
this._animations = null;
},
}
pause: function() {
pause() {
if (this._started && this._count > 0) {
this._timeline.stop();
}
this._started = false;
},
}
start: function() {
start() {
if (!this._started && this._count > 0) {
this._timeline.start();
}
this._started = true;
},
}
addAnimation: function(target, name) {
addAnimation(target, name) {
const targetDestroyId = target.connect('destroy', () => this.removeAnimation(target, name));
this._animations[name].push({ target, targetDestroyId });
this._animations[name].push({ target: target, targetDestroyId: targetDestroyId });
if (this._started && this._count === 0) {
this._timeline.start();
}
this._count++;
},
}
removeAnimation: function(target, name) {
removeAnimation(target, name) {
const pairs = this._animations[name];
for (let i = 0, iMax = pairs.length; i < iMax; i++) {
const pair = pairs[i];
@@ -685,77 +585,7 @@ var IconAnimator = Utils.defineClass({
}
}
}
});
function newViewSelectorAnimateIn(oldPage) {
if (oldPage)
oldPage.hide();
let vs = Main.overview.viewSelector;
vs.emit('page-empty');
vs._activePage.show();
if (vs._activePage == vs._appsPage && oldPage == vs._workspacesPage) {
// Restore opacity, in case we animated via _fadePageOut
vs._activePage.opacity = 255;
let animate = Me.settings.get_boolean('animate-show-apps');
if(animate)
vs.appDisplay.animate(IconGrid.AnimationDirection.IN);
} else {
vs._fadePageIn();
}
}
function newViewSelectorAnimateOut(page) {
let oldPage = page;
let vs = Main.overview.viewSelector;
if (page == vs._appsPage &&
vs._activePage == vs._workspacesPage &&
!Main.overview.animationInProgress) {
let animate = Me.settings.get_boolean('animate-show-apps');
if(animate)
vs.appDisplay.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this,
function() {
vs._animateIn(oldPage)
}));
else
vs._animateIn(oldPage)
} else {
vs._fadePageOut(page);
}
}
function newGetPositionForDirection(direction, fromWs, toWs) {
let [xDest, yDest] = WM.WindowManager.prototype._getPositionForDirection(direction, fromWs, toWs);
if (direction == Meta.MotionDirection.UP ||
direction == Meta.MotionDirection.UP_LEFT ||
direction == Meta.MotionDirection.UP_RIGHT) {
yDest -= Main.panel.height;
} else if (direction != Meta.MotionDirection.LEFT &&
direction != Meta.MotionDirection.RIGHT) {
yDest += Main.panel.height;
}
return [xDest, yDest];
}
function newDoSpringAnimation(animationDirection) {
this._grid.opacity = 255;
this._grid.animateSpring(animationDirection, Main.overview.getShowAppsButton());
}
function newAnimateIconPosition(icon, box, flags, nChangedIcons) {
if (this._needsIconAllocate) {
Utils.allocate(icon, box, flags);
return;
}
return this._oldAnimateIconPosition(icon, box, flags, nChangedIcons);;
}
};
function newUpdateHotCorners() {
// destroy old hot corners
@@ -820,7 +650,7 @@ function newUpdateHotCorners() {
if (haveTopLeftCorner) {
let corner = new Layout.HotCorner(this, monitor, cornerX, cornerY);
corner.setBarrierSize = size => corner.__proto__.setBarrierSize.call(corner, Math.min(size, 32));
corner.setBarrierSize = size => Object.getPrototypeOf(corner).setBarrierSize.call(corner, Math.min(size, 32));
corner.setBarrierSize(panel ? panel.dtpSize : 32);
this.hotCorners.push(corner);
} else {
@@ -855,8 +685,8 @@ function newUpdatePanelBarrier(panel) {
let fixed2 = panel.monitor.y + barrierSize;
if (panel.checkIfVertical()) {
barriers._rightPanelBarrier.push(panel.monitor.y + panel.monitor.height, Meta.BarrierDirection.POSITIVE_Y);
barriers._leftPanelBarrier.push(panel.monitor.y, Meta.BarrierDirection.NEGATIVE_Y);
barriers._rightPanelBarrier.push(panel.monitor.y + panel.monitor.height, Meta.BarrierDirection.NEGATIVE_Y);
barriers._leftPanelBarrier.push(panel.monitor.y, Meta.BarrierDirection.POSITIVE_Y);
} else {
barriers._rightPanelBarrier.push(panel.monitor.x + panel.monitor.width, Meta.BarrierDirection.NEGATIVE_X);
barriers._leftPanelBarrier.push(panel.monitor.x, Meta.BarrierDirection.POSITIVE_X);
@@ -869,12 +699,12 @@ function newUpdatePanelBarrier(panel) {
fixed2 = panel.monitor.y + panel.monitor.height;
break;
case St.Side.LEFT:
fixed1 = panel.monitor.x;
fixed2 = panel.monitor.x + barrierSize;
fixed1 = panel.monitor.x + barrierSize;
fixed2 = panel.monitor.x;
break;
case St.Side.RIGHT:
fixed1 = panel.monitor.x + panel.monitor.width;
fixed2 = panel.monitor.x + panel.monitor.width - barrierSize;
fixed1 = panel.monitor.x + panel.monitor.width - barrierSize;
fixed2 = panel.monitor.x + panel.monitor.width;
break;
}
@@ -891,7 +721,7 @@ function newUpdatePanelBarrier(panel) {
Object.keys(barriers).forEach(k => {
let barrierOptions = {
display: global.display,
backend: global.backend,
directions: barriers[k][2]
};
@@ -908,14 +738,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() {