Drop ES5 support

This commit is contained in:
Charles Gagnon
2022-04-01 22:32:15 -04:00
parent 5d1f8239f4
commit c1c30ce9fa
14 changed files with 926 additions and 1039 deletions

View File

@@ -52,10 +52,9 @@ var Hold = {
PERMANENT: 2
};
var Intellihide = Utils.defineClass({
Name: 'DashToPanel.Intellihide',
var Intellihide = class {
_init: function(dtpPanel) {
constructor(dtpPanel) {
this._dtpPanel = dtpPanel;
this._panelBox = dtpPanel.panelBox;
this._panelManager = dtpPanel.panelManager;
@@ -70,9 +69,9 @@ var Intellihide = Utils.defineClass({
this.enabled = false;
this._changeEnabledStatus();
},
}
enable: function() {
enable() {
this.enabled = true;
this._monitor = this._dtpPanel.monitor;
this._animationDestination = -1;
@@ -101,9 +100,9 @@ var Intellihide = Utils.defineClass({
this._setRevealMechanism();
this._queueUpdatePanelPosition();
},
}
disable: function(reset) {
disable(reset) {
if (this._proximityWatchId) {
this._proximityManager.removeWatch(this._proximityWatchId);
}
@@ -118,43 +117,43 @@ var Intellihide = Utils.defineClass({
this._revealPanel(!reset);
this.enabled = false;
},
}
destroy: function() {
destroy() {
Me.settings.disconnect(this._intellihideChangedId);
Me.settings.disconnect(this._intellihideOnlySecondaryChangedId);
if (this.enabled) {
this.disable();
}
},
}
toggle: function() {
toggle() {
this[this._holdStatus & Hold.PERMANENT ? 'release' : 'revealAndHold'](Hold.PERMANENT);
},
}
revealAndHold: function(holdStatus) {
revealAndHold(holdStatus) {
if (this.enabled && !this._holdStatus) {
this._revealPanel();
}
this._holdStatus |= holdStatus;
},
}
release: function(holdStatus) {
release(holdStatus) {
this._holdStatus -= holdStatus;
if (this.enabled && !this._holdStatus) {
this._queueUpdatePanelPosition();
}
},
}
reset: function() {
reset() {
this.disable(true);
this.enable();
},
}
_changeEnabledStatus: function() {
_changeEnabledStatus() {
let intellihide = Me.settings.get_boolean('intellihide');
let onlySecondary = Me.settings.get_boolean('intellihide-only-secondary');
let enabled = intellihide && !(this._dtpPanel.isPrimary && onlySecondary);
@@ -162,9 +161,9 @@ var Intellihide = Utils.defineClass({
if (this.enabled !== enabled) {
this[enabled ? 'enable' : 'disable']();
}
},
}
_bindGeneralSignals: function() {
_bindGeneralSignals() {
this._signalsHandler.add(
[
this._dtpPanel.taskbar,
@@ -201,14 +200,14 @@ var Intellihide = Utils.defineClass({
() => this._queueUpdatePanelPosition()
]
);
},
}
_onHoverChanged: function() {
_onHoverChanged() {
this._hoveredOut = !this._panelBox.hover;
this._queueUpdatePanelPosition();
},
}
_setTrackPanel: function(enable) {
_setTrackPanel(enable) {
let trackedIndex = Main.layoutManager._findActor(this._panelBox);
let actorData = Main.layoutManager._trackedActors[trackedIndex]
@@ -220,9 +219,9 @@ var Intellihide = Utils.defineClass({
this._panelBox.visible = enable ? enable : this._panelBox.visible;
Main.layoutManager._queueUpdateRegions();
},
}
_setRevealMechanism: function() {
_setRevealMechanism() {
if (global.display.supports_extended_barriers() && Me.settings.get_boolean('intellihide-use-pressure')) {
this._edgeBarrier = this._createBarrier();
this._pressureBarrier = new Layout.PressureBarrier(
@@ -236,9 +235,9 @@ var Intellihide = Utils.defineClass({
this._pointerWatch = PointerWatcher.getPointerWatcher()
.addWatch(CHECK_POINTER_MS, (x, y) => this._checkMousePointer(x, y));
}
},
}
_removeRevealMechanism: function() {
_removeRevealMechanism() {
if (this._pointerWatch) {
PointerWatcher.getPointerWatcher()._removeWatch(this._pointerWatch);
}
@@ -247,9 +246,9 @@ var Intellihide = Utils.defineClass({
this._pressureBarrier.destroy();
this._edgeBarrier.destroy();
}
},
}
_createBarrier: function() {
_createBarrier() {
let position = this._dtpPanel.geom.position;
let opts = { display: global.display };
@@ -276,9 +275,9 @@ var Intellihide = Utils.defineClass({
}
return new Meta.Barrier(opts);
},
}
_checkMousePointer: function(x, y) {
_checkMousePointer(x, y) {
let position = this._dtpPanel.geom.position;
if (!this._panelBox.hover && !Main.overview.visible &&
@@ -290,9 +289,9 @@ var Intellihide = Utils.defineClass({
(y >= this._monitor.y && y < this._monitor.y + this._monitor.height))) {
this._queueUpdatePanelPosition(true);
}
},
}
_queueUpdatePanelPosition: function(fromRevealMechanism) {
_queueUpdatePanelPosition(fromRevealMechanism) {
if (!fromRevealMechanism && this._timeoutsHandler.getId(T2) && !Main.overview.visible) {
//unless this is a mouse interaction or entering/leaving the overview, limit the number
//of updates, but remember to update again when the limit timeout is reached
@@ -301,16 +300,16 @@ var Intellihide = Utils.defineClass({
this._checkIfShouldBeVisible(fromRevealMechanism) ? this._revealPanel() : this._hidePanel();
this._timeoutsHandler.add([T2, MIN_UPDATE_MS, () => this._endLimitUpdate()]);
}
},
}
_endLimitUpdate: function() {
_endLimitUpdate() {
if (this._pendingUpdate) {
this._pendingUpdate = false;
this._queueUpdatePanelPosition();
}
},
}
_checkIfShouldBeVisible: function(fromRevealMechanism) {
_checkIfShouldBeVisible(fromRevealMechanism) {
if (Main.overview.visibleTarget || this._dtpPanel.taskbar.previewMenu.opened ||
this._panelBox.get_hover() || this._checkIfGrab()) {
return true;
@@ -332,35 +331,35 @@ var Intellihide = Utils.defineClass({
}
return !this._windowOverlap;
},
}
_checkIfGrab: function() {
_checkIfGrab() {
if (GrabHelper._grabHelperStack && GrabHelper._grabHelperStack.some(gh => gh._owner == this._dtpPanel.panel.actor)) {
//there currently is a grab on a child of the panel, check again soon to catch its release
this._timeoutsHandler.add([T1, CHECK_GRAB_MS, () => this._queueUpdatePanelPosition()]);
return true;
}
},
}
_revealPanel: function(immediate) {
_revealPanel(immediate) {
if (!this._panelBox.visible) {
this._panelBox.visible = true;
this._dtpPanel.taskbar._shownInitially = false;
}
this._animatePanel(0, immediate);
},
}
_hidePanel: function(immediate) {
_hidePanel(immediate) {
let position = this._dtpPanel.geom.position;
let size = this._panelBox[position == St.Side.LEFT || position == St.Side.RIGHT ? 'width' : 'height'];
let coefficient = position == St.Side.TOP || position == St.Side.LEFT ? -1 : 1;
this._animatePanel(size * coefficient, immediate);
},
}
_animatePanel: function(destination, immediate) {
_animatePanel(destination, immediate) {
let animating = Utils.isAnimating(this._panelBox, this._translationProp);
if (!((animating && destination === this._animationDestination) ||
@@ -397,5 +396,5 @@ var Intellihide = Utils.defineClass({
}
this._hoveredOut = false;
},
});
}
}