[gnome-shell/wip/jimmac/dash-icon-spacing: 31/72] overviewControls: Use adjustment to control layout
- From: Jakub Steiner <jimmac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/jimmac/dash-icon-spacing: 31/72] overviewControls: Use adjustment to control layout
- Date: Tue, 2 Feb 2021 11:58:18 +0000 (UTC)
commit 8fe80ef56ab9d394ad33b8068e1c325917e3e620
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Dec 30 17:32:03 2020 -0300
overviewControls: Use adjustment to control layout
Right now, the adjustment is fixed at ControlsState.WINDOW_PICKER,
but soon it will be propagated to ViewSelector to control the
transitions.
js/ui/overviewControls.js | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 4c315ce316..df03a0dd01 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -12,6 +12,12 @@ var SIDE_CONTROLS_ANIMATION_TIME = Overview.ANIMATION_TIME;
const DASH_HEIGHT_PERCENTAGE = 0.15;
+var ControlsState = {
+ HIDDEN: 0,
+ WINDOW_PICKER: 1,
+ APP_GRID: 2,
+};
+
var DashFader = GObject.registerClass(
class DashFader extends St.Bin {
_init(dash) {
@@ -51,12 +57,15 @@ class DashFader extends St.Bin {
var ControlsManagerLayout = GObject.registerClass(
class ControlsManagerLayout extends Clutter.BinLayout {
- _init(searchEntry, viewSelector, dash) {
+ _init(searchEntry, viewSelector, dash, adjustment) {
super._init();
+ this._adjustment = adjustment;
this._searchEntry = searchEntry;
this._viewSelector = viewSelector;
this._dash = dash;
+
+ adjustment.connect('notify::value', () => this.layout_changed());
}
vfunc_set_container(container) {
@@ -92,9 +101,18 @@ class ControlsManagerLayout extends Clutter.BinLayout {
availableHeight -= dashHeight + spacing;
// ViewSelector
+ const initialBox = new Clutter.ActorBox();
+ initialBox.set_origin(0, 0);
+ initialBox.set_size(width, height);
+
childBox.set_origin(0, searchHeight + spacing);
childBox.set_size(width, availableHeight);
- this._viewSelector.allocate(childBox);
+
+ const page = this._viewSelector.getActivePage();
+ const progress = page === ViewSelector.ViewPage.SEARCH
+ ? 1 : Math.min(this._adjustment.value, 1);
+ const viewSelectorBox = initialBox.interpolate(childBox, progress);
+ this._viewSelector.allocate(viewSelectorBox);
}
});
@@ -140,6 +158,13 @@ class ControlsManager extends St.Widget {
upper: workspaceManager.n_workspaces,
});
+ this._adjustment = new St.Adjustment({
+ actor: this,
+ value: ControlsState.WINDOW_PICKER,
+ lower: ControlsState.HIDDEN,
+ upper: ControlsState.APP_GRID,
+ });
+
this._nWorkspacesNotifyId =
workspaceManager.connect('notify::n-workspaces',
this._updateAdjustment.bind(this));
@@ -152,7 +177,7 @@ class ControlsManager extends St.Widget {
this.add_child(this.viewSelector);
this.layout_manager = new ControlsManagerLayout(searchEntryBin,
- this.viewSelector, this._dashFader);
+ this.viewSelector, this._dashFader, this._adjustment);
this.connect('destroy', this._onDestroy.bind(this));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]