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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1660>
This commit is contained in:
Florian Müllner 2021-02-09 17:50:29 +01:00 committed by Marge Bot
parent 0173a6646f
commit 73b94c3901
2 changed files with 35 additions and 51 deletions

View File

@ -9,6 +9,7 @@ const AppFavorites = imports.ui.appFavorites;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
const IconGrid = imports.ui.iconGrid; const IconGrid = imports.ui.iconGrid;
const Main = imports.ui.main; const Main = imports.ui.main;
const Overview = imports.ui.overview;
var DASH_ANIMATION_TIME = 200; var DASH_ANIMATION_TIME = 200;
var DASH_ITEM_LABEL_SHOW_TIME = 150; 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)); this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this));
Main.overview.connect('item-drag-begin', Main.overview.connect('item-drag-begin',
this._onDragBegin.bind(this)); this._onItemDragBegin.bind(this));
Main.overview.connect('item-drag-end', Main.overview.connect('item-drag-end',
this._onDragEnd.bind(this)); this._onItemDragEnd.bind(this));
Main.overview.connect('item-drag-cancelled', 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 // Translators: this is the name of the dock/favorites area on
// the left of the overview // the left of the overview
Main.ctrlAltTabManager.addGroup(this, _("Dash"), 'user-bookmarks-symbolic'); Main.ctrlAltTabManager.addGroup(this, _("Dash"), 'user-bookmarks-symbolic');
} }
_onDragBegin() { _onItemDragBegin() {
this._dragCancelled = false; this._dragCancelled = false;
this._dragMonitor = { this._dragMonitor = {
dragMotion: this._onDragMotion.bind(this), dragMotion: this._onItemDragMotion.bind(this),
}; };
DND.addDragMonitor(this._dragMonitor); DND.addDragMonitor(this._dragMonitor);
@ -377,26 +384,26 @@ var Dash = GObject.registerClass({
} }
} }
_onDragCancelled() { _onItemDragCancelled() {
this._dragCancelled = true; this._dragCancelled = true;
this._endDrag(); this._endItemDrag();
} }
_onDragEnd() { _onItemDragEnd() {
if (this._dragCancelled) if (this._dragCancelled)
return; return;
this._endDrag(); this._endItemDrag();
} }
_endDrag() { _endItemDrag() {
this._clearDragPlaceholder(); this._clearDragPlaceholder();
this._clearEmptyDropTarget(); this._clearEmptyDropTarget();
this._showAppsIcon.setDragApp(null); this._showAppsIcon.setDragApp(null);
DND.removeDragMonitor(this._dragMonitor); DND.removeDragMonitor(this._dragMonitor);
} }
_onDragMotion(dragEvent) { _onItemDragMotion(dragEvent) {
let app = getAppFromSource(dragEvent.source); let app = getAppFromSource(dragEvent.source);
if (app == null) if (app == null)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
@ -415,6 +422,22 @@ var Dash = GObject.registerClass({
return DND.DragMotionResult.CONTINUE; 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) { _appIdListToHash(apps) {
let ids = {}; let ids = {};
for (let i = 0; i < apps.length; i++) for (let i = 0; i < apps.length; i++)

View File

@ -4,45 +4,7 @@
const { Clutter, GObject, St } = imports.gi; const { Clutter, GObject, St } = imports.gi;
const Dash = imports.ui.dash; const Dash = imports.ui.dash;
const Main = imports.ui.main;
const ViewSelector = imports.ui.viewSelector; 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( var ControlsManager = GObject.registerClass(
class ControlsManager extends St.Widget { class ControlsManager extends St.Widget {
@ -55,7 +17,6 @@ class ControlsManager extends St.Widget {
}); });
this.dash = new Dash.Dash(); this.dash = new Dash.Dash();
this._dashFader = new DashFader(this.dash);
let workspaceManager = global.workspace_manager; let workspaceManager = global.workspace_manager;
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index(); let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
@ -86,7 +47,7 @@ class ControlsManager extends St.Widget {
this.add_actor(this._group); this.add_actor(this._group);
this._group.add_child(this.viewSelector); 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)); this.connect('destroy', this._onDestroy.bind(this));
} }