From 73b94c390147e710948c370b4bd40fe5eaaa0fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 9 Feb 2021 17:50:29 +0100 Subject: [PATCH] overviewControls: Remove DashFader By now there is so little left of the old sliding controls that the split from the actual dash makes little sense. https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/89 Part-of: --- js/ui/dash.js | 45 +++++++++++++++++++++++++++++---------- js/ui/overviewControls.js | 41 +---------------------------------- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/js/ui/dash.js b/js/ui/dash.js index 6b4c114e7..52b07a51c 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -9,6 +9,7 @@ const AppFavorites = imports.ui.appFavorites; const DND = imports.ui.dnd; const IconGrid = imports.ui.iconGrid; const Main = imports.ui.main; +const Overview = imports.ui.overview; var DASH_ANIMATION_TIME = 200; var DASH_ITEM_LABEL_SHOW_TIME = 150; @@ -352,21 +353,27 @@ var Dash = GObject.registerClass({ this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this)); Main.overview.connect('item-drag-begin', - this._onDragBegin.bind(this)); + this._onItemDragBegin.bind(this)); Main.overview.connect('item-drag-end', - this._onDragEnd.bind(this)); + this._onItemDragEnd.bind(this)); Main.overview.connect('item-drag-cancelled', - this._onDragCancelled.bind(this)); + this._onItemDragCancelled.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)); // Translators: this is the name of the dock/favorites area on // the left of the overview Main.ctrlAltTabManager.addGroup(this, _("Dash"), 'user-bookmarks-symbolic'); } - _onDragBegin() { + _onItemDragBegin() { this._dragCancelled = false; this._dragMonitor = { - dragMotion: this._onDragMotion.bind(this), + dragMotion: this._onItemDragMotion.bind(this), }; DND.addDragMonitor(this._dragMonitor); @@ -377,26 +384,26 @@ var Dash = GObject.registerClass({ } } - _onDragCancelled() { + _onItemDragCancelled() { this._dragCancelled = true; - this._endDrag(); + this._endItemDrag(); } - _onDragEnd() { + _onItemDragEnd() { if (this._dragCancelled) return; - this._endDrag(); + this._endItemDrag(); } - _endDrag() { + _endItemDrag() { this._clearDragPlaceholder(); this._clearEmptyDropTarget(); this._showAppsIcon.setDragApp(null); DND.removeDragMonitor(this._dragMonitor); } - _onDragMotion(dragEvent) { + _onItemDragMotion(dragEvent) { let app = getAppFromSource(dragEvent.source); if (app == null) return DND.DragMotionResult.CONTINUE; @@ -415,6 +422,22 @@ var Dash = GObject.registerClass({ return DND.DragMotionResult.CONTINUE; } + _onWindowDragBegin() { + this.ease({ + opacity: 128, + duration: Overview.ANIMATION_TIME / 2, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + }); + } + + _onWindowDragEnd() { + this.ease({ + opacity: 255, + duration: Overview.ANIMATION_TIME / 2, + mode: Clutter.AnimationMode.EASE_IN_QUAD, + }); + } + _appIdListToHash(apps) { let ids = {}; for (let i = 0; i < apps.length; i++) diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index e87c5042a..b27a1d9f6 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -4,45 +4,7 @@ const { Clutter, GObject, St } = imports.gi; const Dash = imports.ui.dash; -const Main = imports.ui.main; const ViewSelector = imports.ui.viewSelector; -const Overview = imports.ui.overview; - -var SIDE_CONTROLS_ANIMATION_TIME = Overview.ANIMATION_TIME; - -var DashFader = GObject.registerClass( -class DashFader extends St.Widget { - _init(dash) { - super._init({ - x_expand: true, - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.END, - }); - - this._dash = dash; - this.add_child(this._dash); - - 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.ease({ - opacity: 128, - duration: SIDE_CONTROLS_ANIMATION_TIME / 2, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - }); - } - - _onWindowDragEnd() { - this.ease({ - opacity: 255, - duration: SIDE_CONTROLS_ANIMATION_TIME / 2, - mode: Clutter.AnimationMode.EASE_IN_QUAD, - }); - } -}); var ControlsManager = GObject.registerClass( class ControlsManager extends St.Widget { @@ -55,7 +17,6 @@ class ControlsManager extends St.Widget { }); this.dash = new Dash.Dash(); - this._dashFader = new DashFader(this.dash); let workspaceManager = global.workspace_manager; let activeWorkspaceIndex = workspaceManager.get_active_workspace_index(); @@ -86,7 +47,7 @@ class ControlsManager extends St.Widget { this.add_actor(this._group); this._group.add_child(this.viewSelector); - this._group.add_actor(this._dashFader); + this._group.add_actor(this.dash); this.connect('destroy', this._onDestroy.bind(this)); }