panel: prevent blink of current app indicator
If new current app is null, show animation of disappearing old. https://bugzilla.gnome.org/show_bug.cgi?id=615099
This commit is contained in:
parent
edabafc0fc
commit
69d6ae4141
@ -244,6 +244,10 @@ AppMenuButton.prototype = {
|
|||||||
|
|
||||||
let bin = new St.Bin({ name: 'appMenu' });
|
let bin = new St.Bin({ name: 'appMenu' });
|
||||||
this.actor.set_child(bin);
|
this.actor.set_child(bin);
|
||||||
|
|
||||||
|
this.actor.reactive = false;
|
||||||
|
this._targetIsCurrent = false;
|
||||||
|
|
||||||
this._container = new Shell.GenericContainer();
|
this._container = new Shell.GenericContainer();
|
||||||
bin.set_child(this._container);
|
bin.set_child(this._container);
|
||||||
this._container.connect('get-preferred-width', Lang.bind(this, this._getContentPreferredWidth));
|
this._container.connect('get-preferred-width', Lang.bind(this, this._getContentPreferredWidth));
|
||||||
@ -501,13 +505,6 @@ AppMenuButton.prototype = {
|
|||||||
lastStartedApp = this._startingApps[i];
|
lastStartedApp = this._startingApps[i];
|
||||||
|
|
||||||
let focusedApp = tracker.focus_app;
|
let focusedApp = tracker.focus_app;
|
||||||
let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
|
|
||||||
if (targetApp == this._targetApp) {
|
|
||||||
if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
|
|
||||||
this.stopAnimation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._stopAnimation();
|
|
||||||
|
|
||||||
if (!focusedApp) {
|
if (!focusedApp) {
|
||||||
// If the app has just lost focus to the panel, pretend
|
// If the app has just lost focus to the panel, pretend
|
||||||
@ -517,27 +514,56 @@ AppMenuButton.prototype = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
|
||||||
|
|
||||||
|
if (targetApp == null) {
|
||||||
|
if (!this._targetIsCurrent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.actor.reactive = false;
|
||||||
|
this._targetIsCurrent = false;
|
||||||
|
|
||||||
|
Tweener.removeTweens(this.actor);
|
||||||
|
Tweener.addTween(this.actor, { opacity: 0,
|
||||||
|
time: Overview.ANIMATION_TIME,
|
||||||
|
transition: 'easeOutQuad' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._targetIsCurrent) {
|
||||||
|
this.actor.reactive = true;
|
||||||
|
this._targetIsCurrent = true;
|
||||||
|
|
||||||
|
Tweener.removeTweens(this.actor);
|
||||||
|
Tweener.addTween(this.actor, { opacity: 255,
|
||||||
|
time: Overview.ANIMATION_TIME,
|
||||||
|
transition: 'easeOutQuad' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetApp == this._targetApp) {
|
||||||
|
if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
|
||||||
|
this.stopAnimation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._stopAnimation();
|
||||||
|
|
||||||
if (this._iconBox.child != null)
|
if (this._iconBox.child != null)
|
||||||
this._iconBox.child.destroy();
|
this._iconBox.child.destroy();
|
||||||
this._iconBox.hide();
|
this._iconBox.hide();
|
||||||
this._label.setText('');
|
this._label.setText('');
|
||||||
this.actor.reactive = false;
|
|
||||||
|
|
||||||
this._targetApp = targetApp;
|
this._targetApp = targetApp;
|
||||||
if (targetApp != null) {
|
|
||||||
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
|
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
|
||||||
|
|
||||||
this._label.setText(targetApp.get_name());
|
this._label.setText(targetApp.get_name());
|
||||||
// TODO - _quit() doesn't really work on apps in state STARTING yet
|
// TODO - _quit() doesn't really work on apps in state STARTING yet
|
||||||
this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
|
this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
|
||||||
|
|
||||||
this.actor.reactive = true;
|
|
||||||
this._iconBox.set_child(icon);
|
this._iconBox.set_child(icon);
|
||||||
this._iconBox.show();
|
this._iconBox.show();
|
||||||
|
|
||||||
if (targetApp.get_state() == Shell.AppState.STARTING)
|
if (targetApp.get_state() == Shell.AppState.STARTING)
|
||||||
this.startAnimation();
|
this.startAnimation();
|
||||||
}
|
|
||||||
|
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user