cleanup: Use type-safe comparisons

We have been using type-safe comparisons in new code for quite a while
now, however old code has only been adapted slowly.

Change all the remaining bits to get rid of another legacy style
difference.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
This commit is contained in:
Florian Müllner
2023-08-07 02:51:19 +02:00
committed by Marge Bot
parent 9a3913d4a0
commit a42f7c2384
94 changed files with 847 additions and 845 deletions

View File

@ -32,7 +32,7 @@ export const EdgeDragAction = GObject.registerClass({
}
vfunc_gesture_prepare(_actor) {
if (this.get_n_current_points() == 0)
if (this.get_n_current_points() === 0)
return false;
if (!(this._allowedModes & Main.actionMode))
@ -41,10 +41,10 @@ export const EdgeDragAction = GObject.registerClass({
let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y);
return (this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
(this._side == St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
(this._side == St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
return (this._side === St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
(this._side === St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
(this._side === St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
(this._side === St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
}
vfunc_gesture_progress(_actor) {
@ -57,9 +57,9 @@ export const EdgeDragAction = GObject.registerClass({
return true;
if ((offsetX > offsetY &&
(this._side == St.Side.TOP || this._side == St.Side.BOTTOM)) ||
(this._side === St.Side.TOP || this._side === St.Side.BOTTOM)) ||
(offsetY > offsetX &&
(this._side == St.Side.LEFT || this._side == St.Side.RIGHT))) {
(this._side === St.Side.LEFT || this._side === St.Side.RIGHT))) {
this.cancel();
return false;
}
@ -78,10 +78,10 @@ export const EdgeDragAction = GObject.registerClass({
let [x, y] = this.get_motion_coords(0);
let monitorRect = this._getMonitorRect(startX, startY);
if ((this._side == St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) ||
(this._side == St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) ||
(this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
(this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
if ((this._side === St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) ||
(this._side === St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) ||
(this._side === St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
(this._side === St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
this.emit('activated');
else
this.cancel();