overview: Add OverviewActor and use as main actor of the Overlay
Use the Overview class as controller, while create the actual overlay actor using a GObject-derived class. Replace actual properties with getter-only properties. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:
parent
4e1492c926
commit
91eb84fa4e
@ -127,11 +127,11 @@ function *run() {
|
|||||||
for (let i = 0; i < 2; i++) {
|
for (let i = 0; i < 2; i++) {
|
||||||
Scripting.scriptEvent('applicationsShowStart');
|
Scripting.scriptEvent('applicationsShowStart');
|
||||||
// eslint-disable-next-line require-atomic-updates
|
// eslint-disable-next-line require-atomic-updates
|
||||||
Main.overview._dash.showAppsButton.checked = true;
|
Main.overview.dash.showAppsButton.checked = true;
|
||||||
yield Scripting.waitLeisure();
|
yield Scripting.waitLeisure();
|
||||||
Scripting.scriptEvent('applicationsShowDone');
|
Scripting.scriptEvent('applicationsShowDone');
|
||||||
// eslint-disable-next-line require-atomic-updates
|
// eslint-disable-next-line require-atomic-updates
|
||||||
Main.overview._dash.showAppsButton.checked = false;
|
Main.overview.dash.showAppsButton.checked = false;
|
||||||
yield Scripting.waitLeisure();
|
yield Scripting.waitLeisure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ function *run() {
|
|||||||
|
|
||||||
Scripting.scriptEvent('applicationsShowStart');
|
Scripting.scriptEvent('applicationsShowStart');
|
||||||
// eslint-disable-next-line require-atomic-updates
|
// eslint-disable-next-line require-atomic-updates
|
||||||
Main.overview._dash.showAppsButton.checked = true;
|
Main.overview.dash.showAppsButton.checked = true;
|
||||||
|
|
||||||
yield Scripting.waitLeisure();
|
yield Scripting.waitLeisure();
|
||||||
Scripting.scriptEvent('applicationsShowDone');
|
Scripting.scriptEvent('applicationsShowDone');
|
||||||
|
@ -229,8 +229,9 @@ class BaseAppView {
|
|||||||
|
|
||||||
_doSpringAnimation(animationDirection) {
|
_doSpringAnimation(animationDirection) {
|
||||||
this._grid.opacity = 255;
|
this._grid.opacity = 255;
|
||||||
this._grid.animateSpring(animationDirection,
|
this._grid.animateSpring(
|
||||||
Main.overview.getShowAppsButton());
|
animationDirection,
|
||||||
|
Main.overview.dash.showAppsButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
animate(animationDirection, onComplete) {
|
animate(animationDirection, onComplete) {
|
||||||
@ -2260,7 +2261,7 @@ var AppIcon = class AppIcon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDragActor() {
|
getDragActor() {
|
||||||
return this.app.create_icon_texture(Main.overview.dashIconSize);
|
return this.app.create_icon_texture(Main.overview.dash.iconSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the original actor that should align with the actor
|
// Returns the original actor that should align with the actor
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported Overview */
|
/* exported Overview */
|
||||||
|
|
||||||
const { Clutter, GLib, Meta, Shell, St } = imports.gi;
|
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Background = imports.ui.background;
|
const Background = imports.ui.background;
|
||||||
@ -76,32 +76,92 @@ var ShellInfo = class {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var OverviewActor = GObject.registerClass(
|
||||||
|
class OverviewActor extends St.BoxLayout {
|
||||||
|
_init() {
|
||||||
|
super._init({
|
||||||
|
name: 'overview',
|
||||||
|
/* Translators: This is the main view to select
|
||||||
|
activities. See also note for "Activities" string. */
|
||||||
|
accessible_name: _("Overview"),
|
||||||
|
vertical: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add_constraint(new LayoutManager.MonitorConstraint({ primary: true }));
|
||||||
|
|
||||||
|
// Add a clone of the panel to the overview so spacing and such is
|
||||||
|
// automatic
|
||||||
|
let panelGhost = new St.Bin({
|
||||||
|
child: new Clutter.Clone({ source: Main.panel }),
|
||||||
|
reactive: false,
|
||||||
|
opacity: 0
|
||||||
|
});
|
||||||
|
this.add_actor(panelGhost);
|
||||||
|
|
||||||
|
this._searchEntry = new St.Entry({
|
||||||
|
style_class: 'search-entry',
|
||||||
|
/* Translators: this is the text displayed
|
||||||
|
in the search entry when no search is
|
||||||
|
active; it should not exceed ~30
|
||||||
|
characters. */
|
||||||
|
hint_text: _("Type to search…"),
|
||||||
|
track_hover: true,
|
||||||
|
can_focus: true
|
||||||
|
});
|
||||||
|
let searchEntryBin = new St.Bin({
|
||||||
|
child: this._searchEntry,
|
||||||
|
x_align: St.Align.MIDDLE
|
||||||
|
});
|
||||||
|
this.add_actor(searchEntryBin);
|
||||||
|
|
||||||
|
this._controls = new OverviewControls.ControlsManager(this._searchEntry);
|
||||||
|
|
||||||
|
// Add our same-line elements after the search entry
|
||||||
|
this.add(this._controls.actor, { y_fill: true, expand: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
get dash() {
|
||||||
|
return this._controls.dash;
|
||||||
|
}
|
||||||
|
|
||||||
|
get searchEntry() {
|
||||||
|
return this._searchEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
get viewSelector() {
|
||||||
|
return this._controls.viewSelector;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var Overview = class {
|
var Overview = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._overviewCreated = false;
|
|
||||||
this._initCalled = false;
|
this._initCalled = false;
|
||||||
|
|
||||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get dash() {
|
||||||
|
return this._overview.dash;
|
||||||
|
}
|
||||||
|
|
||||||
|
get dashIconSize() {
|
||||||
|
logError(new Error('Usage of Overview.\'dashIconSize\' is deprecated, ' +
|
||||||
|
'use \'dash.iconSize\' property instead'));
|
||||||
|
return this.dash.iconSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
get viewSelector() {
|
||||||
|
return this._overview.viewSelector;
|
||||||
|
}
|
||||||
|
|
||||||
_createOverview() {
|
_createOverview() {
|
||||||
if (this._overviewCreated)
|
if (this._overview)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._overviewCreated = true;
|
|
||||||
|
|
||||||
this._overview = new St.BoxLayout({ name: 'overview',
|
|
||||||
/* Translators: This is the main view to select
|
|
||||||
activities. See also note for "Activities" string. */
|
|
||||||
accessible_name: _("Overview"),
|
|
||||||
vertical: true });
|
|
||||||
this._overview.add_constraint(new LayoutManager.MonitorConstraint({ primary: true }));
|
|
||||||
this._overview._delegate = this;
|
|
||||||
|
|
||||||
// The main Background actors are inside global.window_group which are
|
// The main Background actors are inside global.window_group which are
|
||||||
// hidden when displaying the overview, so we create a new
|
// hidden when displaying the overview, so we create a new
|
||||||
// one. Instances of this class share a single CoglTexture behind the
|
// one. Instances of this class share a single CoglTexture behind the
|
||||||
@ -129,9 +189,6 @@ var Overview = class {
|
|||||||
reactive: true });
|
reactive: true });
|
||||||
Main.layoutManager.overviewGroup.add_child(this._coverPane);
|
Main.layoutManager.overviewGroup.add_child(this._coverPane);
|
||||||
this._coverPane.connect('event', () => Clutter.EVENT_STOP);
|
this._coverPane.connect('event', () => Clutter.EVENT_STOP);
|
||||||
|
|
||||||
Main.layoutManager.overviewGroup.add_child(this._overview);
|
|
||||||
|
|
||||||
this._coverPane.hide();
|
this._coverPane.hide();
|
||||||
|
|
||||||
// XDND
|
// XDND
|
||||||
@ -213,41 +270,12 @@ var Overview = class {
|
|||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this._overview = new OverviewActor();
|
||||||
|
this._overview._delegate = this;
|
||||||
|
Main.layoutManager.overviewGroup.add_child(this._overview);
|
||||||
|
|
||||||
this._shellInfo = new ShellInfo();
|
this._shellInfo = new ShellInfo();
|
||||||
|
|
||||||
// Add a clone of the panel to the overview so spacing and such is
|
|
||||||
// automatic
|
|
||||||
this._panelGhost = new St.Bin({ child: new Clutter.Clone({ source: Main.panel }),
|
|
||||||
reactive: false,
|
|
||||||
opacity: 0 });
|
|
||||||
this._overview.add_actor(this._panelGhost);
|
|
||||||
|
|
||||||
this._searchEntry = new St.Entry({ style_class: 'search-entry',
|
|
||||||
/* Translators: this is the text displayed
|
|
||||||
in the search entry when no search is
|
|
||||||
active; it should not exceed ~30
|
|
||||||
characters. */
|
|
||||||
hint_text: _("Type to search…"),
|
|
||||||
track_hover: true,
|
|
||||||
can_focus: true });
|
|
||||||
this._searchEntryBin = new St.Bin({ child: this._searchEntry,
|
|
||||||
x_align: St.Align.MIDDLE });
|
|
||||||
this._overview.add_actor(this._searchEntryBin);
|
|
||||||
|
|
||||||
// Create controls
|
|
||||||
this._controls = new OverviewControls.ControlsManager(this._searchEntry);
|
|
||||||
this._dash = this._controls.dash;
|
|
||||||
this.viewSelector = this._controls.viewSelector;
|
|
||||||
|
|
||||||
// Add our same-line elements after the search entry
|
|
||||||
this._overview.add(this._controls.actor, { y_fill: true, expand: true });
|
|
||||||
|
|
||||||
// TODO - recalculate everything when desktop size changes
|
|
||||||
this.dashIconSize = this._dash.iconSize;
|
|
||||||
this._dash.connect('icon-size-changed', () => {
|
|
||||||
this.dashIconSize = this._dash.iconSize;
|
|
||||||
});
|
|
||||||
|
|
||||||
Main.layoutManager.connect('monitors-changed', this._relayout.bind(this));
|
Main.layoutManager.connect('monitors-changed', this._relayout.bind(this));
|
||||||
this._relayout();
|
this._relayout();
|
||||||
}
|
}
|
||||||
@ -426,7 +454,7 @@ var Overview = class {
|
|||||||
|
|
||||||
focusSearch() {
|
focusSearch() {
|
||||||
this.show();
|
this.show();
|
||||||
this._searchEntry.grab_key_focus();
|
this._overview.searchEntry.grab_key_focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
fadeInDesktop() {
|
fadeInDesktop() {
|
||||||
@ -468,7 +496,7 @@ var Overview = class {
|
|||||||
return false;
|
return false;
|
||||||
if (this._inItemDrag || this._inWindowDrag)
|
if (this._inItemDrag || this._inWindowDrag)
|
||||||
return false;
|
return false;
|
||||||
if (this._activationTime == 0 ||
|
if (!this._activationTime ||
|
||||||
GLib.get_monotonic_time() / GLib.USEC_PER_SEC - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT)
|
GLib.get_monotonic_time() / GLib.USEC_PER_SEC - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@ -640,7 +668,10 @@ var Overview = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getShowAppsButton() {
|
getShowAppsButton() {
|
||||||
return this._dash.showAppsButton;
|
logError(new Error('Usage of Overview.\'getShowAppsButton\' is deprecated, ' +
|
||||||
|
'use \'dash.showAppsButton\' property instead'));
|
||||||
|
|
||||||
|
return this.dash.showAppsButton;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Signals.addSignalMethods(Overview.prototype);
|
Signals.addSignalMethods(Overview.prototype);
|
||||||
|
Loading…
Reference in New Issue
Block a user