124 lines
4.5 KiB
Diff
124 lines
4.5 KiB
Diff
|
Index: mutter-3.28.0/src/wayland/meta-xwayland.c
|
||
|
===================================================================
|
||
|
--- mutter-3.28.0.orig/src/wayland/meta-xwayland.c
|
||
|
+++ mutter-3.28.0/src/wayland/meta-xwayland.c
|
||
|
@@ -32,6 +32,12 @@
|
||
|
#include <sys/socket.h>
|
||
|
#include <sys/un.h>
|
||
|
|
||
|
+/* For g_open() */
|
||
|
+#include <glib/gstdio.h>
|
||
|
+#include <fcntl.h>
|
||
|
+#include <sys/types.h>
|
||
|
+#include <sys/stat.h>
|
||
|
+
|
||
|
#include "compositor/meta-surface-actor-wayland.h"
|
||
|
#include "wayland/meta-wayland-actor-surface.h"
|
||
|
|
||
|
@@ -508,6 +514,37 @@ on_displayfd_ready (int fd,
|
||
|
return G_SOURCE_REMOVE;
|
||
|
}
|
||
|
|
||
|
+/* Look for an Xauthority file that may have been created by gdm */
|
||
|
+static char *
|
||
|
+find_auth_file (void)
|
||
|
+{
|
||
|
+ char *auth_dir = NULL;
|
||
|
+ char *auth_file = NULL;
|
||
|
+ int fd;
|
||
|
+
|
||
|
+ auth_dir = g_build_filename (g_get_user_runtime_dir (),
|
||
|
+ "gdm",
|
||
|
+ NULL);
|
||
|
+
|
||
|
+ auth_file = g_build_filename (auth_dir, "Xauthority", NULL);
|
||
|
+ g_clear_pointer (&auth_dir, g_free);
|
||
|
+
|
||
|
+ /* Check that we can open the file. In theory it could still go away before
|
||
|
+ * Xwayland gets a chance to run, but at least we can be fairly sure. */
|
||
|
+
|
||
|
+ fd = g_open (auth_file, O_RDWR, 0700);
|
||
|
+
|
||
|
+ if (fd < 0) {
|
||
|
+ g_clear_pointer (&auth_file, g_free);
|
||
|
+ goto out;
|
||
|
+ }
|
||
|
+
|
||
|
+ g_close (fd, NULL);
|
||
|
+
|
||
|
+out:
|
||
|
+ return auth_file;
|
||
|
+}
|
||
|
+
|
||
|
gboolean
|
||
|
meta_xwayland_start (MetaXWaylandManager *manager,
|
||
|
struct wl_display *wl_display)
|
||
|
@@ -517,11 +554,14 @@ meta_xwayland_start (MetaXWaylandManager
|
||
|
gboolean started = FALSE;
|
||
|
g_autoptr(GSubprocessLauncher) launcher = NULL;
|
||
|
GSubprocessFlags flags;
|
||
|
+ gchar *auth_file = NULL;
|
||
|
GError *error = NULL;
|
||
|
|
||
|
if (!choose_xdisplay (manager))
|
||
|
goto out;
|
||
|
|
||
|
+ auth_file = find_auth_file ();
|
||
|
+
|
||
|
/* We want xwayland to be a wayland client so we make a socketpair to setup a
|
||
|
* wayland protocol connection. */
|
||
|
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, xwayland_client_fd) < 0)
|
||
|
@@ -560,16 +600,34 @@ meta_xwayland_start (MetaXWaylandManager
|
||
|
* won't try to reconnect and crash, leaving uninteresting core dumps. We do
|
||
|
* want core dumps from Xwayland but only if a real bug occurs...
|
||
|
*/
|
||
|
- manager->proc = g_subprocess_launcher_spawn (launcher, &error,
|
||
|
- XWAYLAND_PATH, manager->display_name,
|
||
|
- "-rootless",
|
||
|
- "-terminate",
|
||
|
- "-accessx",
|
||
|
- "-core",
|
||
|
- "-listen", "4",
|
||
|
- "-listen", "5",
|
||
|
- "-displayfd", "6",
|
||
|
- NULL);
|
||
|
+ if (auth_file)
|
||
|
+ {
|
||
|
+ manager->proc = g_subprocess_launcher_spawn (launcher, &error,
|
||
|
+ XWAYLAND_PATH, manager->display_name,
|
||
|
+ "-rootless",
|
||
|
+ "-terminate",
|
||
|
+ "-accessx",
|
||
|
+ "-core",
|
||
|
+ "-auth", auth_file,
|
||
|
+ "-listen", "4",
|
||
|
+ "-listen", "5",
|
||
|
+ "-displayfd", "6",
|
||
|
+ NULL);
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ manager->proc = g_subprocess_launcher_spawn (launcher, &error,
|
||
|
+ XWAYLAND_PATH, manager->display_name,
|
||
|
+ "-rootless",
|
||
|
+ "-terminate",
|
||
|
+ "-accessx",
|
||
|
+ "-core",
|
||
|
+ "-listen", "4",
|
||
|
+ "-listen", "5",
|
||
|
+ "-displayfd", "6",
|
||
|
+ NULL);
|
||
|
+ }
|
||
|
+
|
||
|
if (!manager->proc)
|
||
|
{
|
||
|
g_error ("Failed to spawn Xwayland: %s", error->message);
|
||
|
@@ -591,6 +649,7 @@ meta_xwayland_start (MetaXWaylandManager
|
||
|
started = TRUE;
|
||
|
|
||
|
out:
|
||
|
+ g_free (auth_file);
|
||
|
if (!started)
|
||
|
{
|
||
|
unlink (manager->lock_file);
|