Don't switch to a workspace when dragging it to launch on that workspace
With workspace thumbnails, we don't switch workspaces when dragging windows between workspaces or adding new workspaces, so we also shouldn't switch on launch. * Add workspace parameters to shell_doc_system_open(), shell_app_activate, shell_app_open_new_window() * Pass a 'params' object when activating items in the overview with two currently defined parameters: workspace and timestamp. (timestamp is only implemented where it is easy and doesn't require interface changes - using the global current timestamp for the shell is almost always right or at least good enough.) https://bugzilla.gnome.org/show_bug.cgi?id=640996
This commit is contained in:
@ -411,6 +411,8 @@ shell_app_activate_window (ShellApp *app,
|
||||
/**
|
||||
* shell_app_activate:
|
||||
* @app: a #ShellApp
|
||||
* @workspace: launch on this workspace, or -1 for default. Ignored if
|
||||
* activating an existing window
|
||||
*
|
||||
* Perform an appropriate default action for operating on this application,
|
||||
* dependent on its current state. For example, if the application is not
|
||||
@ -419,13 +421,19 @@ shell_app_activate_window (ShellApp *app,
|
||||
* recently used transient for that window).
|
||||
*/
|
||||
void
|
||||
shell_app_activate (ShellApp *app)
|
||||
shell_app_activate (ShellApp *app,
|
||||
int workspace)
|
||||
{
|
||||
switch (app->state)
|
||||
{
|
||||
case SHELL_APP_STATE_STOPPED:
|
||||
/* TODO sensibly handle this error */
|
||||
shell_app_info_launch (app->info, NULL);
|
||||
shell_app_info_launch_full (app->info,
|
||||
0,
|
||||
NULL,
|
||||
workspace,
|
||||
NULL,
|
||||
NULL);
|
||||
break;
|
||||
case SHELL_APP_STATE_STARTING:
|
||||
break;
|
||||
@ -438,11 +446,13 @@ shell_app_activate (ShellApp *app)
|
||||
/**
|
||||
* shell_app_open_new_window:
|
||||
* @app: a #ShellApp
|
||||
* @workspace: open on this workspace, or -1 for default
|
||||
*
|
||||
* Request that the application create a new window.
|
||||
*/
|
||||
void
|
||||
shell_app_open_new_window (ShellApp *app)
|
||||
shell_app_open_new_window (ShellApp *app,
|
||||
int workspace)
|
||||
{
|
||||
/* Here we just always launch the application again, even if we know
|
||||
* it was already running. For most applications this
|
||||
@ -452,7 +462,12 @@ shell_app_open_new_window (ShellApp *app)
|
||||
* as say Pidgin. Ideally, we have the application express to us
|
||||
* that it supports an explicit new-window action.
|
||||
*/
|
||||
shell_app_info_launch (app->info, NULL);
|
||||
shell_app_info_launch_full (app->info,
|
||||
0,
|
||||
NULL,
|
||||
workspace,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,9 +44,11 @@ gboolean shell_app_is_transient (ShellApp *app);
|
||||
|
||||
void shell_app_activate_window (ShellApp *app, MetaWindow *window, guint32 timestamp);
|
||||
|
||||
void shell_app_activate (ShellApp *app);
|
||||
void shell_app_activate (ShellApp *app,
|
||||
int workspace);
|
||||
|
||||
void shell_app_open_new_window (ShellApp *app);
|
||||
void shell_app_open_new_window (ShellApp *app,
|
||||
int workspace);
|
||||
|
||||
ShellAppState shell_app_get_state (ShellApp *app);
|
||||
|
||||
|
@ -227,17 +227,24 @@ shell_doc_system_on_recent_changed (GtkRecentManager *manager,
|
||||
* shell_doc_system_open:
|
||||
* @system: A #ShellDocSystem
|
||||
* @info: A #GtkRecentInfo
|
||||
* @workspace: Open on this workspace, or -1 for default
|
||||
*
|
||||
* Launch the default application associated with the mime type of
|
||||
* @info, using its uri.
|
||||
*/
|
||||
void
|
||||
shell_doc_system_open (ShellDocSystem *system,
|
||||
GtkRecentInfo *info)
|
||||
GtkRecentInfo *info,
|
||||
int workspace)
|
||||
{
|
||||
GFile *file;
|
||||
GAppInfo *app_info;
|
||||
gboolean needs_uri;
|
||||
GAppLaunchContext *context;
|
||||
|
||||
context = shell_global_create_app_launch_context (shell_global_get ());
|
||||
if (workspace != -1)
|
||||
gdk_app_launch_context_set_desktop ((GdkAppLaunchContext *)context, workspace);
|
||||
|
||||
file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
|
||||
needs_uri = g_file_get_path (file) == NULL;
|
||||
@ -248,7 +255,7 @@ shell_doc_system_open (ShellDocSystem *system,
|
||||
{
|
||||
GList *uris;
|
||||
uris = g_list_prepend (NULL, (gpointer)gtk_recent_info_get_uri (info));
|
||||
g_app_info_launch_uris (app_info, uris, shell_global_create_app_launch_context (shell_global_get ()), NULL);
|
||||
g_app_info_launch_uris (app_info, uris, context, NULL);
|
||||
g_list_free (uris);
|
||||
}
|
||||
else
|
||||
@ -267,7 +274,6 @@ shell_doc_system_open (ShellDocSystem *system,
|
||||
if (gtk_recent_info_get_application_info (info, app_name, &app_exec, &count, &time))
|
||||
{
|
||||
GRegex *regex;
|
||||
GAppLaunchContext *context;
|
||||
|
||||
/* TODO: Change this once better support for creating
|
||||
GAppInfo is added to GtkRecentInfo, as right now
|
||||
@ -298,13 +304,13 @@ shell_doc_system_open (ShellDocSystem *system,
|
||||
despite passing the app launch context, no startup
|
||||
notification occurs.
|
||||
*/
|
||||
context = shell_global_create_app_launch_context (shell_global_get ());
|
||||
g_app_info_launch (app_info, NULL, context, NULL);
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
g_free (app_name);
|
||||
}
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -41,6 +41,7 @@ void shell_doc_system_queue_existence_check (ShellDocSystem *system,
|
||||
guint n_items);
|
||||
|
||||
void shell_doc_system_open (ShellDocSystem *system,
|
||||
GtkRecentInfo *info);
|
||||
GtkRecentInfo *info,
|
||||
int workspace);
|
||||
|
||||
#endif /* __SHELL_DOC_SYSTEM_H__ */
|
||||
|
Reference in New Issue
Block a user