[gnome-shell] overviewControls: Split FaderControl from SlidingControl
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] overviewControls: Split FaderControl from SlidingControl
- Date: Tue, 19 Jan 2021 14:04:54 +0000 (UTC)
commit bd850c3110e49b62b77d513146f848fea272cbfc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Dec 11 09:44:53 2020 -0300
overviewControls: Split FaderControl from SlidingControl
The Dash will need only the fading aspect of SlidingControl in the
next commit.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1559>
js/ui/overviewControls.js | 88 ++++++++++++++++++++++++++++-------------------
1 file changed, 52 insertions(+), 36 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index af0263f14b..05a177df0e 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -100,8 +100,57 @@ var SlideLayout = GObject.registerClass({
}
});
+var FaderControl = GObject.registerClass(
+class FaderControl extends St.Widget {
+ _init(params) {
+ super._init(params);
+
+ this._inDrag = false;
+
+ Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
+ Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+ Main.overview.connect('item-drag-cancelled', this._onDragEnd.bind(this));
+
+ Main.overview.connect('window-drag-begin', this._onWindowDragBegin.bind(this));
+ Main.overview.connect('window-drag-cancelled', this._onWindowDragEnd.bind(this));
+ Main.overview.connect('window-drag-end', this._onWindowDragEnd.bind(this));
+ }
+
+ _onWindowDragBegin() {
+ this._onDragBegin();
+ }
+
+ _onWindowDragEnd() {
+ this._onDragEnd();
+ }
+
+ _onDragBegin() {
+ this._inDrag = true;
+ }
+
+ _onDragEnd() {
+ this._inDrag = false;
+ }
+
+ fadeIn() {
+ this.ease({
+ opacity: 255,
+ duration: SIDE_CONTROLS_ANIMATION_TIME / 2,
+ mode: Clutter.AnimationMode.EASE_IN_QUAD,
+ });
+ }
+
+ fadeHalf() {
+ this.ease({
+ opacity: 128,
+ duration: SIDE_CONTROLS_ANIMATION_TIME / 2,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ });
+ }
+});
+
var SlidingControl = GObject.registerClass(
-class SlidingControl extends St.Widget {
+class SlidingControl extends FaderControl {
_init(params) {
params = Params.parse(params, { slideDirection: SlideDirection.LEFT });
@@ -114,17 +163,8 @@ class SlidingControl extends St.Widget {
});
this._visible = true;
- this._inDrag = false;
Main.overview.connect('hiding', this._onOverviewHiding.bind(this));
-
- Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
- Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
- Main.overview.connect('item-drag-cancelled', this._onDragEnd.bind(this));
-
- Main.overview.connect('window-drag-begin', this._onWindowDragBegin.bind(this));
- Main.overview.connect('window-drag-cancelled', this._onWindowDragEnd.bind(this));
- Main.overview.connect('window-drag-end', this._onWindowDragEnd.bind(this));
}
_getSlide() {
@@ -183,41 +223,17 @@ class SlidingControl extends St.Widget {
this.slideOut();
}
- _onWindowDragBegin() {
- this._onDragBegin();
- }
-
- _onWindowDragEnd() {
- this._onDragEnd();
- }
-
_onDragBegin() {
- this._inDrag = true;
+ super._onDragBegin();
this._updateTranslation();
this._updateSlide();
}
_onDragEnd() {
- this._inDrag = false;
+ super._onDragEnd();
this._updateSlide();
}
- fadeIn() {
- this.ease({
- opacity: 255,
- duration: SIDE_CONTROLS_ANIMATION_TIME / 2,
- mode: Clutter.AnimationMode.EASE_IN_QUAD,
- });
- }
-
- fadeHalf() {
- this.ease({
- opacity: 128,
- duration: SIDE_CONTROLS_ANIMATION_TIME / 2,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- });
- }
-
slideIn() {
this._visible = true;
// we will update slide_x and the translation from pageEmpty
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]