[gnome-shell/wip/swarm: 123/126] 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: 123/126] appDisplay: Allow animating appIcon on new window
- Date: Mon, 11 Aug 2014 20:31:01 +0000 (UTC)
commit 6411e653a4e4e1c03f7301510763791c22ba6000
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 c8de63a..0881f67 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1531,10 +1531,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,
@@ -1648,13 +1649,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() {
@@ -1708,19 +1703,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 });
@@ -1741,6 +1746,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);
@@ -1802,6 +1814,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]