viewSelector: Move to a sync() model for deciding which page to show
https://bugzilla.gnome.org/show_bug.cgi?id=722196
This commit is contained in:
parent
a7d7f94892
commit
51e63233ce
@ -118,13 +118,13 @@ const ViewSelector = new Lang.Class({
|
|||||||
this._stageKeyPressId = 0;
|
this._stageKeyPressId = 0;
|
||||||
Main.overview.connect('showing', Lang.bind(this,
|
Main.overview.connect('showing', Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
this._resetShowAppsButton();
|
this._showAppsButton.checked = false;
|
||||||
this._stageKeyPressId = global.stage.connect('key-press-event',
|
this._stageKeyPressId = global.stage.connect('key-press-event',
|
||||||
Lang.bind(this, this._onStageKeyPress));
|
Lang.bind(this, this._onStageKeyPress));
|
||||||
}));
|
}));
|
||||||
Main.overview.connect('hiding', Lang.bind(this,
|
Main.overview.connect('hiding', Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
this._resetShowAppsButton();
|
this._showAppsButton.checked = false;
|
||||||
if (this._stageKeyPressId != 0) {
|
if (this._stageKeyPressId != 0) {
|
||||||
global.stage.disconnect(this._stageKeyPressId);
|
global.stage.disconnect(this._stageKeyPressId);
|
||||||
this._stageKeyPressId = 0;
|
this._stageKeyPressId = 0;
|
||||||
@ -162,7 +162,7 @@ const ViewSelector = new Lang.Class({
|
|||||||
|
|
||||||
this._workspacesDisplay.show();
|
this._workspacesDisplay.show();
|
||||||
this._activePage = null;
|
this._activePage = null;
|
||||||
this._showPage(this._workspacesPage);
|
this._syncActivePage();
|
||||||
|
|
||||||
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
|
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
|
||||||
Main.overview.fadeOutDesktop();
|
Main.overview.fadeOutDesktop();
|
||||||
@ -221,7 +221,7 @@ const ViewSelector = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPage: function(page, noFade) {
|
_showPage: function(page) {
|
||||||
if (page == this._activePage)
|
if (page == this._activePage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ const ViewSelector = new Lang.Class({
|
|||||||
this._activePage = page;
|
this._activePage = page;
|
||||||
this.emit('page-changed');
|
this.emit('page-changed');
|
||||||
|
|
||||||
if (oldPage && !noFade)
|
if (oldPage)
|
||||||
Tweener.addTween(oldPage,
|
Tweener.addTween(oldPage,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||||
@ -248,20 +248,24 @@ const ViewSelector = new Lang.Class({
|
|||||||
page.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
page.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShowAppsButtonToggled: function() {
|
_getActivePage: function() {
|
||||||
if (this._showAppsBlocked)
|
if (this._searchActive)
|
||||||
return;
|
return this._searchPage;
|
||||||
|
else if (this._showAppsButton.checked)
|
||||||
this._showPage(this._showAppsButton.checked ?
|
return this._appsPage;
|
||||||
this._appsPage : this._workspacesPage);
|
else
|
||||||
|
return this._workspacesPage;
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetShowAppsButton: function() {
|
_syncActivePage: function() {
|
||||||
this._showAppsBlocked = true;
|
let activePage = this._getActivePage();
|
||||||
this._showAppsButton.checked = false;
|
if (activePage == this._activePage)
|
||||||
this._showAppsBlocked = false;
|
return;
|
||||||
|
this._showPage(activePage);
|
||||||
|
},
|
||||||
|
|
||||||
this._showPage(this._workspacesPage, true);
|
_onShowAppsButtonToggled: function() {
|
||||||
|
this._syncActivePage();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStageKeyPress: function(actor, event) {
|
_onStageKeyPress: function(actor, event) {
|
||||||
@ -287,20 +291,6 @@ const ViewSelector = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_searchCancelled: function() {
|
|
||||||
this._showPage(this._showAppsButton.checked ? this._appsPage
|
|
||||||
: this._workspacesPage);
|
|
||||||
|
|
||||||
// Leave the entry focused when it doesn't have any text;
|
|
||||||
// when replacing a selected search term, Clutter emits
|
|
||||||
// two 'text-changed' signals, one for deleting the previous
|
|
||||||
// text and one for the new one - the second one is handled
|
|
||||||
// incorrectly when we remove focus
|
|
||||||
// (https://bugzilla.gnome.org/show_bug.cgi?id=636341) */
|
|
||||||
if (this._text.text != '')
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
reset: function () {
|
reset: function () {
|
||||||
global.stage.set_key_focus(null);
|
global.stage.set_key_focus(null);
|
||||||
|
|
||||||
@ -391,8 +381,18 @@ const ViewSelector = new Lang.Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._entry.set_secondary_icon(null);
|
this._entry.set_secondary_icon(null);
|
||||||
this._searchCancelled();
|
|
||||||
|
// Leave the entry focused when it doesn't have any text;
|
||||||
|
// when replacing a selected search term, Clutter emits
|
||||||
|
// two 'text-changed' signals, one for deleting the previous
|
||||||
|
// text and one for the new one - the second one is handled
|
||||||
|
// incorrectly when we remove focus
|
||||||
|
// (https://bugzilla.gnome.org/show_bug.cgi?id=636341) */
|
||||||
|
if (this._text.text != '')
|
||||||
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._syncActivePage();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPress: function(entry, event) {
|
_onKeyPress: function(entry, event) {
|
||||||
@ -459,9 +459,7 @@ const ViewSelector = new Lang.Class({
|
|||||||
this._searchTimeoutId = 0;
|
this._searchTimeoutId = 0;
|
||||||
|
|
||||||
let terms = getTermsForSearchString(this._entry.get_text());
|
let terms = getTermsForSearchString(this._entry.get_text());
|
||||||
|
|
||||||
this._searchResults.setTerms(terms);
|
this._searchResults.setTerms(terms);
|
||||||
this._showPage(this._searchPage);
|
|
||||||
|
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user