diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 975667c4b..a69b677b6 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -334,10 +334,9 @@ AppSearchProvider.prototype = { }, activateResult: function(id, params) { - params = Params.parse(params, { workspace: null, - timestamp: null }); + params = Params.parse(params, { workspace: -1, + timestamp: 0 }); - let workspace = params.workspace ? params.workspace.index() : -1; let event = Clutter.get_current_event(); let modifiers = event ? Shell.get_event_state(event) : 0; let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK; @@ -346,15 +345,15 @@ AppSearchProvider.prototype = { if (openNewWindow) app.open_new_window(workspace); else - app.activate(workspace); + app.activate_full(params.workspace, params.timestamp); }, dragActivateResult: function(id, params) { - params = Params.parse(params, { workspace: null, - timestamp: null }); + params = Params.parse(params, { workspace: -1, + timestamp: 0 }); let app = this._appSys.lookup_app(id); - app.open_new_window(params.workspace ? params.workspace.index() : -1); + app.open_new_window(workspace); }, createResultActor: function (resultMeta, terms) { @@ -395,10 +394,10 @@ SettingsSearchProvider.prototype = { }, activateResult: function(pref, params) { - params = Params.parse(params, { workspace: null, - timestamp: null }); + params = Params.parse(params, { workspace: -1, + timestamp: 0 }); - pref.activate(params.workspace); + pref.activate_full(params.workspace, params.timestamp); }, dragActivateResult: function(pref, params) { @@ -596,17 +595,17 @@ AppWellIcon.prototype = { && this.app.state == Shell.AppState.RUNNING) { this.app.open_new_window(-1); } else { - this.app.activate(-1); + this.app.activate(); } } Main.overview.hide(); }, shellWorkspaceLaunch : function(params) { - params = Params.parse(params, { workspace: null, - timestamp: null }); + params = Params.parse(params, { workspace: -1, + timestamp: 0 }); - this.app.open_new_window(params.workspace ? params.workspace.index() : -1); + this.app.open_new_window(params.workspace); }, getDragActor: function() { diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 99ad76d4a..a8824dc26 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -200,7 +200,7 @@ DateMenuButton.prototype = { this.menu.close(); Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-datetime-panel.desktop'); - app.activate(-1); + app.activate(); }, _onOpenCalendarActivate: function() { diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js index 6a289b0ec..10646fb83 100644 --- a/js/ui/docDisplay.js +++ b/js/ui/docDisplay.js @@ -30,11 +30,11 @@ DocSearchProvider.prototype = { }, activateResult: function(id, params) { - params = Params.parse(params, { workspace: null, - timestamp: null }); + params = Params.parse(params, { workspace: -1, + timestamp: 0 }); let docInfo = this._docManager.lookupByUri(id); - docInfo.launch(params.workspace ? params.workspace.index() : -1); + docInfo.launch(params.workspace); }, getInitialResultSet: function(terms) { diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js index cad887d78..70f996a32 100644 --- a/js/ui/endSessionDialog.js +++ b/js/ui/endSessionDialog.js @@ -173,7 +173,7 @@ ListItem.prototype = { _onClicked: function() { this.emit('activate'); - this._app.activate(-1); + this._app.activate(); } }; Signals.addSignalMethods(ListItem.prototype); diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js index 93542476d..edfef06a2 100644 --- a/js/ui/placeDisplay.js +++ b/js/ui/placeDisplay.js @@ -60,13 +60,13 @@ PlaceInfo.prototype = { // Helper function to translate launch parameters into a GAppLaunchContext function _makeLaunchContext(params) { - params = Params.parse(params, { workspace: null, - timestamp: null }); + params = Params.parse(params, { workspace: -1, + timestamp: 0 }); let launchContext = global.create_app_launch_context(); - if (params.workspace != null) - launchContext.set_desktop(params.workspace.index()); - if (params.timestamp != null) + if (params.workspace != -1) + launchContext.set_desktop(params.workspace); + if (params.timestamp != 0) launchContext.set_timestamp(params.timestamp); return launchContext; diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index d85e77fe6..9ccaaea6e 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -84,7 +84,7 @@ ListItem.prototype = { _onClicked: function() { this.emit('activate'); - this._app.activate(-1); + this._app.activate(); } }; Signals.addSignalMethods(ListItem.prototype); @@ -402,4 +402,4 @@ ShellProcessesDialog.prototype = { _setButtonsForChoices(this, choices); } } -Signals.addSignalMethods(ShellProcessesDialog.prototype); \ No newline at end of file +Signals.addSignalMethods(ShellProcessesDialog.prototype); diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index 542c230b7..7792ed4ab 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -91,7 +91,7 @@ ATIndicator.prototype = { this.menu.addAction(_("Universal Access Settings"), function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-universal-access-panel.desktop'); - app.activate(-1); + app.activate(); }); }, diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index a73eb7e83..d5069963f 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -92,7 +92,7 @@ Indicator.prototype = { this.menu.addAction(_("Bluetooth Settings"), function() { Main.overview.hide() let app = Shell.AppSystem.get_default().lookup_setting('bluetooth-properties.desktop'); - app.activate(-1); + app.activate(); }); this._applet.connect('pincode-request', Lang.bind(this, this._pinRequest)); diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 0ae99299b..1db0d8286 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -75,7 +75,7 @@ XKBIndicator.prototype = { this.menu.addAction(_("Region and Language Settings"), function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-region-panel.desktop'); - app.activate(-1); + app.activate(); }); }, diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 38b2e25ab..4b4aaac63 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1605,7 +1605,7 @@ NMApplet.prototype = { this.menu.addAction(_("Network Settings"), function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-network-panel.desktop'); - app.activate(-1); + app.activate(); }); this._activeConnections = [ ]; diff --git a/js/ui/status/power.js b/js/ui/status/power.js index 1f5b5bb3c..482711bf5 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -83,7 +83,7 @@ Indicator.prototype = { this.menu.addAction(_("Power Settings"),function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-power-panel.desktop'); - app.activate(-1); + app.activate(); }); this._proxy.connect('Changed', Lang.bind(this, this._devicesChanged)); diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index adc120791..0c02a9e60 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -64,7 +64,7 @@ Indicator.prototype = { this.menu.addAction(_("Sound Settings"), function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-sound-panel.desktop'); - app.activate(-1); + app.activate(); }); this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); diff --git a/js/ui/statusMenu.js b/js/ui/statusMenu.js index f2d825c49..21bc2b128 100644 --- a/js/ui/statusMenu.js +++ b/js/ui/statusMenu.js @@ -275,13 +275,13 @@ StatusMenuButton.prototype = { _onMyAccountActivate: function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_setting('gnome-user-accounts-panel.desktop'); - app.activate(-1); + app.activate(); }, _onPreferencesActivate: function() { Main.overview.hide(); let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop'); - app.activate(-1); + app.activate(); }, _onLockScreenActivate: function() { diff --git a/js/ui/workspace.js b/js/ui/workspace.js index acb890487..e7ff208df 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1440,7 +1440,7 @@ Workspace.prototype = { time); return true; } else if (source.shellWorkspaceLaunch) { - source.shellWorkspaceLaunch({ workspace: this.metaWorkspace, + source.shellWorkspaceLaunch({ workspace: this.metaWorkspace ? this.metaWorkspace.index() : -1, timestamp: time }); return true; } diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 5123042cd..582842b89 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -452,7 +452,7 @@ WorkspaceThumbnail.prototype = { time); return true; } else if (source.shellWorkspaceLaunch) { - source.shellWorkspaceLaunch({ workspace: this.metaWorkspace, + source.shellWorkspaceLaunch({ workspace: this.metaWorkspace ? this.metaWorkspace.index() : -1, timestamp: time }); return true; } diff --git a/src/shell-app.c b/src/shell-app.c index c3380553f..1654401fa 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -508,8 +508,22 @@ shell_app_activate_window (ShellApp *app, /** * shell_app_activate: * @app: a #ShellApp + * + * Like shell_app_activate_full(), but using the default workspace and + * event timestamp. + */ +void +shell_app_activate (ShellApp *app) +{ + return shell_app_activate_full (app, -1, 0); +} + +/** + * shell_app_activate_full: + * @app: a #ShellApp * @workspace: launch on this workspace, or -1 for default. Ignored if * activating an existing window + * @timestamp: Event timestamp * * Perform an appropriate default action for operating on this application, * dependent on its current state. For example, if the application is not @@ -518,8 +532,9 @@ shell_app_activate_window (ShellApp *app, * recently used transient for that window). */ void -shell_app_activate (ShellApp *app, - int workspace) +shell_app_activate_full (ShellApp *app, + int workspace, + guint32 timestamp) { switch (app->state) { @@ -527,7 +542,7 @@ shell_app_activate (ShellApp *app, { GError *error = NULL; if (!shell_app_launch (app, - 0, + timestamp, NULL, workspace, NULL, @@ -546,7 +561,7 @@ shell_app_activate (ShellApp *app, case SHELL_APP_STATE_STARTING: break; case SHELL_APP_STATE_RUNNING: - shell_app_activate_window (app, NULL, shell_global_get_current_time (shell_global_get ())); + shell_app_activate_window (app, NULL, timestamp); break; } } diff --git a/src/shell-app.h b/src/shell-app.h index d1aed0231..8f4f0e6c2 100644 --- a/src/shell-app.h +++ b/src/shell-app.h @@ -47,8 +47,11 @@ gboolean shell_app_is_window_backed (ShellApp *app); void shell_app_activate_window (ShellApp *app, MetaWindow *window, guint32 timestamp); -void shell_app_activate (ShellApp *app, - int workspace); +void shell_app_activate (ShellApp *app); + +void shell_app_activate_full (ShellApp *app, + int workspace, + guint32 timestamp); void shell_app_open_new_window (ShellApp *app, int workspace);