shell-app: Add "discrete_gpu" option when launching apps
And adapt existing callers to the new API. This will allow us to implement a way to launch applications on the discrete GPU for systems where an "Optimus" system exists. https://bugzilla.gnome.org/show_bug.cgi?id=773117
This commit is contained in:
@ -505,7 +505,7 @@ shell_app_activate_full (ShellApp *app,
|
||||
case SHELL_APP_STATE_STOPPED:
|
||||
{
|
||||
GError *error = NULL;
|
||||
if (!shell_app_launch (app, timestamp, workspace, &error))
|
||||
if (!shell_app_launch (app, timestamp, workspace, FALSE, &error))
|
||||
{
|
||||
char *msg;
|
||||
msg = g_strdup_printf (_("Failed to launch “%s”"), shell_app_get_name (app));
|
||||
@ -549,7 +549,7 @@ 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_launch (app, 0, workspace, NULL);
|
||||
shell_app_launch (app, 0, workspace, FALSE, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1200,12 +1200,14 @@ app_child_setup (gpointer user_data)
|
||||
* shell_app_launch:
|
||||
* @timestamp: Event timestamp, or 0 for current event timestamp
|
||||
* @workspace: Start on this workspace, or -1 for default
|
||||
* @discrete_gpu: Whether to start on the discrete GPU
|
||||
* @error: A #GError
|
||||
*/
|
||||
gboolean
|
||||
shell_app_launch (ShellApp *app,
|
||||
guint timestamp,
|
||||
int workspace,
|
||||
gboolean discrete_gpu,
|
||||
GError **error)
|
||||
{
|
||||
ShellGlobal *global;
|
||||
@ -1227,6 +1229,8 @@ shell_app_launch (ShellApp *app,
|
||||
|
||||
global = shell_global_get ();
|
||||
context = shell_global_create_app_launch_context (global, timestamp, workspace);
|
||||
if (discrete_gpu)
|
||||
g_app_launch_context_setenv (context, "DRI_PRIME", "1");
|
||||
|
||||
ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL,
|
||||
context,
|
||||
|
@ -54,6 +54,7 @@ gboolean shell_app_is_on_workspace (ShellApp *app, MetaWorkspace *workspace);
|
||||
gboolean shell_app_launch (ShellApp *app,
|
||||
guint timestamp,
|
||||
int workspace,
|
||||
gboolean discrete_gpu,
|
||||
GError **error);
|
||||
|
||||
void shell_app_launch_action (ShellApp *app,
|
||||
|
Reference in New Issue
Block a user