|
|
e47e58 |
From 5e3a6efd0e2bbea040e203b996e7d00ab3431cfa Mon Sep 17 00:00:00 2001
|
|
|
e47e58 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
e47e58 |
Date: Tue, 13 Feb 2018 09:44:50 -0500
|
|
|
e47e58 |
Subject: [PATCH] main: be more aggressive in assuming X11 backend
|
|
|
e47e58 |
|
|
|
e47e58 |
If the session is started by vncserver right now, the
|
|
|
e47e58 |
XDG_SESSION_TYPE won't be X11. Ideally that would be
|
|
|
e47e58 |
fixed, but for backward compatibility we should default
|
|
|
e47e58 |
to X11 if the session type isn't set to wayland explicitly.
|
|
|
e47e58 |
---
|
|
|
e47e58 |
src/core/main.c | 8 +++-----
|
|
|
e47e58 |
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
e47e58 |
|
|
|
e47e58 |
diff --git a/src/core/main.c b/src/core/main.c
|
|
|
e47e58 |
index 079f6a9ef..8e8bc3f77 100644
|
|
|
e47e58 |
--- a/src/core/main.c
|
|
|
e47e58 |
+++ b/src/core/main.c
|
|
|
e47e58 |
@@ -304,108 +304,106 @@ meta_finalize (void)
|
|
|
e47e58 |
|
|
|
e47e58 |
#ifdef HAVE_WAYLAND
|
|
|
e47e58 |
if (meta_is_wayland_compositor ())
|
|
|
e47e58 |
meta_wayland_finalize ();
|
|
|
e47e58 |
#endif
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
static gboolean
|
|
|
e47e58 |
on_sigterm (gpointer user_data)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
meta_quit (EXIT_SUCCESS);
|
|
|
e47e58 |
|
|
|
e47e58 |
return G_SOURCE_REMOVE;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
#if defined(HAVE_WAYLAND) && defined(HAVE_NATIVE_BACKEND)
|
|
|
e47e58 |
static gboolean
|
|
|
e47e58 |
session_type_is_supported (const char *session_type)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
return (g_strcmp0 (session_type, "x11") == 0) ||
|
|
|
e47e58 |
(g_strcmp0 (session_type, "wayland") == 0);
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
static char *
|
|
|
e47e58 |
find_session_type (void)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
char **sessions = NULL;
|
|
|
e47e58 |
char *session_id;
|
|
|
e47e58 |
char *session_type;
|
|
|
e47e58 |
const char *session_type_env;
|
|
|
e47e58 |
- gboolean is_tty = FALSE;
|
|
|
e47e58 |
int ret, i;
|
|
|
e47e58 |
|
|
|
e47e58 |
ret = sd_pid_get_session (0, &session_id);
|
|
|
e47e58 |
if (ret == 0 && session_id != NULL)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
ret = sd_session_get_type (session_id, &session_type);
|
|
|
e47e58 |
free (session_id);
|
|
|
e47e58 |
|
|
|
e47e58 |
if (ret == 0)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
if (session_type_is_supported (session_type))
|
|
|
e47e58 |
goto out;
|
|
|
e47e58 |
- else
|
|
|
e47e58 |
- is_tty = g_strcmp0 (session_type, "tty") == 0;
|
|
|
e47e58 |
+
|
|
|
e47e58 |
free (session_type);
|
|
|
e47e58 |
}
|
|
|
e47e58 |
}
|
|
|
e47e58 |
else if (sd_uid_get_sessions (getuid (), 1, &sessions) > 0)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
for (i = 0; sessions[i] != NULL; i++)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
ret = sd_session_get_type (sessions[i], &session_type);
|
|
|
e47e58 |
|
|
|
e47e58 |
if (ret < 0)
|
|
|
e47e58 |
continue;
|
|
|
e47e58 |
|
|
|
e47e58 |
if (session_type_is_supported (session_type))
|
|
|
e47e58 |
{
|
|
|
e47e58 |
g_strfreev (sessions);
|
|
|
e47e58 |
goto out;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
free (session_type);
|
|
|
e47e58 |
}
|
|
|
e47e58 |
}
|
|
|
e47e58 |
g_strfreev (sessions);
|
|
|
e47e58 |
|
|
|
e47e58 |
session_type_env = g_getenv ("XDG_SESSION_TYPE");
|
|
|
e47e58 |
if (session_type_is_supported (session_type_env))
|
|
|
e47e58 |
{
|
|
|
e47e58 |
/* The string should be freeable */
|
|
|
e47e58 |
session_type = strdup (session_type_env);
|
|
|
e47e58 |
goto out;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
- /* Legacy support for starting through xinit */
|
|
|
e47e58 |
- if (is_tty && (g_getenv ("MUTTER_DISPLAY") || g_getenv ("DISPLAY")))
|
|
|
e47e58 |
+ /* Legacy support for starting through xinit or vncserver */
|
|
|
e47e58 |
+ if (g_getenv ("MUTTER_DISPLAY") || g_getenv ("DISPLAY"))
|
|
|
e47e58 |
{
|
|
|
e47e58 |
session_type = strdup ("x11");
|
|
|
e47e58 |
goto out;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
meta_warning ("Unsupported session type\n");
|
|
|
e47e58 |
meta_exit (META_EXIT_ERROR);
|
|
|
e47e58 |
|
|
|
e47e58 |
out:
|
|
|
e47e58 |
return session_type;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
static gboolean
|
|
|
e47e58 |
check_for_wayland_session_type (void)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
char *session_type;
|
|
|
e47e58 |
gboolean is_wayland;
|
|
|
e47e58 |
|
|
|
e47e58 |
session_type = find_session_type ();
|
|
|
e47e58 |
is_wayland = g_strcmp0 (session_type, "wayland") == 0;
|
|
|
e47e58 |
free (session_type);
|
|
|
e47e58 |
|
|
|
e47e58 |
return is_wayland;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
#endif
|
|
|
e47e58 |
|
|
|
e47e58 |
/*
|
|
|
e47e58 |
* Determine the compositor configuration, i.e. whether to run as a Wayland
|
|
|
e47e58 |
* compositor, as well as what backend to use.
|
|
|
e47e58 |
*
|
|
|
e47e58 |
--
|
|
|
e47e58 |
2.14.3
|
|
|
e47e58 |
|