overview: Make public properties read-only

Overview's animationInProgress, visible and visibleTarget properties are not
meant to be modified from others, but be read only.

So make this clearer using properties getters and private values.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:
Marco Trevisan (Treviño) 2019-08-31 04:04:34 +02:00 committed by Florian Müllner
parent db7726c5bf
commit a3c6217875

View File

@ -155,6 +155,18 @@ var Overview = class {
return this._overview.viewSelector; return this._overview.viewSelector;
} }
get animationInProgress() {
return this._animationInProgress;
}
get visible() {
return this._visible;
}
get visibleTarget() {
return this._visibleTarget;
}
_createOverview() { _createOverview() {
if (this._overview) if (this._overview)
return; return;
@ -176,11 +188,11 @@ var Overview = class {
this._activationTime = 0; this._activationTime = 0;
this.visible = false; // animating to overview, in overview, animating out this._visible = false; // animating to overview, in overview, animating out
this._shown = false; // show() and not hide() this._shown = false; // show() and not hide()
this._modal = false; // have a modal grab this._modal = false; // have a modal grab
this.animationInProgress = false; this._animationInProgress = false;
this.visibleTarget = false; this._visibleTarget = false;
// During transitions, we raise this to the top to avoid having the overview // During transitions, we raise this to the top to avoid having the overview
// area be reactive; it causes too many issues such as double clicks on // area be reactive; it causes too many issues such as double clicks on
@ -492,7 +504,7 @@ var Overview = class {
// the overview if the user both triggered the hot corner and // the overview if the user both triggered the hot corner and
// clicked the Activities button. // clicked the Activities button.
shouldToggleByCornerOrButton() { shouldToggleByCornerOrButton() {
if (this.animationInProgress) if (this._animationInProgress)
return false; return false;
if (this._inItemDrag || this._inWindowDrag) if (this._inItemDrag || this._inWindowDrag)
return false; return false;
@ -506,7 +518,7 @@ var Overview = class {
// We delay grab changes during animation so that when removing the // We delay grab changes during animation so that when removing the
// overview we don't have a problem with the release of a press/release // overview we don't have a problem with the release of a press/release
// going to an application. // going to an application.
if (this.animationInProgress) if (this._animationInProgress)
return true; return true;
if (this._shown) { if (this._shown) {
@ -548,12 +560,12 @@ var Overview = class {
_animateVisible() { _animateVisible() {
if (this.visible || this.animationInProgress) if (this._visible || this._animationInProgress)
return; return;
this.visible = true; this._visible = true;
this.animationInProgress = true; this._animationInProgress = true;
this.visibleTarget = true; this._visibleTarget = true;
this._activationTime = GLib.get_monotonic_time() / GLib.USEC_PER_SEC; this._activationTime = GLib.get_monotonic_time() / GLib.USEC_PER_SEC;
Meta.disable_unredirect_for_display(global.display); Meta.disable_unredirect_for_display(global.display);
@ -574,7 +586,7 @@ var Overview = class {
} }
_showDone() { _showDone() {
this.animationInProgress = false; this._animationInProgress = false;
this._desktopFade.hide(); this._desktopFade.hide();
this._coverPane.hide(); this._coverPane.hide();
@ -614,11 +626,11 @@ var Overview = class {
} }
_animateNotVisible() { _animateNotVisible() {
if (!this.visible || this.animationInProgress) if (!this._visible || this._animationInProgress)
return; return;
this.animationInProgress = true; this._animationInProgress = true;
this.visibleTarget = false; this._visibleTarget = false;
this.viewSelector.animateFromOverview(); this.viewSelector.animateFromOverview();
@ -644,8 +656,8 @@ var Overview = class {
this._desktopFade.hide(); this._desktopFade.hide();
this._coverPane.hide(); this._coverPane.hide();
this.visible = false; this._visible = false;
this.animationInProgress = false; this._animationInProgress = false;
this.emit('hidden'); this.emit('hidden');
// Handle any calls to show* while we were hiding // Handle any calls to show* while we were hiding
@ -661,7 +673,7 @@ var Overview = class {
if (this.isDummy) if (this.isDummy)
return; return;
if (this.visible) if (this._visible)
this.hide(); this.hide();
else else
this.show(); this.show();