Blame SOURCES/0001-main-be-more-aggressive-in-assuming-X11-backend.patch

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