[gnome-shell/wip/swarm: 10/13] appDisplay: Allow animating appIcon on new window
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/swarm: 10/13] appDisplay: Allow animating appIcon on new window
- Date: Tue, 12 Aug 2014 15:25:43 +0000 (UTC)
commit 1cab67eb2a86ae9c3b018cbf02e25e37eb24d4c4
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Mon Aug 11 16:41:57 2014 +0200
appDisplay: Allow animating appIcon on new window
js/ui/appDisplay.js | 44 ++++++++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 3fe1f65..6f02051 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1527,10 +1527,11 @@ Signals.addSignalMethods(AppFolderPopup.prototype);
const AppIcon = new Lang.Class({
Name: 'AppIcon',
- _init : function(app, iconParams) {
+ _init : function(app, iconParams, params) {
this.app = app;
this.id = app.get_id();
this.name = app.get_name();
+ this.params = Params.parse(params, { animateOnNewWindow: false });
this.actor = new St.Button({ style_class: 'app-well-app',
reactive: true,
@@ -1644,13 +1645,7 @@ const AppIcon = new Lang.Class({
_onClicked: function(actor, button) {
this._removeMenuTimeout();
-
- if (button == 0 || button == 1) {
- this._onActivate(Clutter.get_current_event());
- } else if (button == 2) {
- this.app.open_new_window(-1);
- Main.overview.hide();
- }
+ this.activate(button);
},
_onKeyboardPopupMenu: function() {
@@ -1704,19 +1699,29 @@ const AppIcon = new Lang.Class({
this.emit('menu-state-changed', false);
},
- _onActivate: function (event) {
- let modifiers = event.get_state();
+ activate: function (button) {
+ let event = Clutter.get_current_event();
+ let modifiers = event ? event.get_state() : 0;
+ let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK &&
+ this.app.state == Shell.AppState.RUNNING ||
+ button && button == 2;
- if (modifiers & Clutter.ModifierType.CONTROL_MASK
- && this.app.state == Shell.AppState.RUNNING) {
+ if (this.params.animateOnNewWindow &&
+ (this.app.state == Shell.AppState.STOPPED || openNewWindow))
+ this.animateOut();
+
+ if (openNewWindow)
this.app.open_new_window(-1);
- } else {
+ else
this.app.activate();
- }
Main.overview.hide();
},
+ animateOut: function() {
+ this.icon.animateOut();
+ },
+
shellWorkspaceLaunch : function(params) {
params = Params.parse(params, { workspace: -1,
timestamp: 0 });
@@ -1737,6 +1742,13 @@ const AppIcon = new Lang.Class({
shouldShowTooltip: function() {
return this.actor.hover && (!this._menu || !this._menu.isOpen);
},
+
+ setSelected: function(selected) {
+ if (selected)
+ this.actor.add_style_pseudo_class('selected');
+ else
+ this.actor.remove_style_pseudo_class('selected');
+ }
});
Signals.addSignalMethods(AppIcon.prototype);
@@ -1798,6 +1810,10 @@ const AppIconMenu = new Lang.Class({
if (this._source.app.can_open_new_window()) {
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
+ if (this._source.params.animateOnNewWindow &&
+ this._source.app.state == Shell.AppState.STOPPED)
+ this._source.animateOut();
+
this._source.app.open_new_window(-1);
this.emit('activate-window', null);
}));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]