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

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