|
|
ebfe55 |
From 8e756d48ed31bcacf12b99cbd82fb2052503f51e Mon Sep 17 00:00:00 2001
|
|
|
ebfe55 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
ebfe55 |
Date: Tue, 18 Jun 2019 16:12:46 +0200
|
|
|
ebfe55 |
Subject: [PATCH 1/4] xwayland: Generate a Xauth file and pass this to Xwayland
|
|
|
ebfe55 |
when starting it
|
|
|
ebfe55 |
|
|
|
ebfe55 |
Before this commit, sudo x11-app, e.g. sudo gvim /etc/some-file, fails
|
|
|
ebfe55 |
when running a Wayland session. Where as doing this under a "GNOME on Xorg"
|
|
|
ebfe55 |
session works fine. For a user switching from the Xorg session to the
|
|
|
ebfe55 |
Wayland session, this is regression, which we want to avoid.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
This commit fixes this by creating and passing an xauth file to Xwayland when
|
|
|
ebfe55 |
mutter starts it. Just like gdm or startx pass a xauth file to Xorg when they
|
|
|
ebfe55 |
start Xorg.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
Fixes #643
|
|
|
ebfe55 |
|
|
|
ebfe55 |
https://gitlab.gnome.org/GNOME/mutter/issues/643
|
|
|
ebfe55 |
---
|
|
|
ebfe55 |
meson.build | 1 +
|
|
|
ebfe55 |
src/meson.build | 1 +
|
|
|
ebfe55 |
src/wayland/meta-wayland-private.h | 1 +
|
|
|
ebfe55 |
src/wayland/meta-wayland.c | 11 +++-
|
|
|
ebfe55 |
src/wayland/meta-xwayland.c | 81 ++++++++++++++++++++++++++++++
|
|
|
ebfe55 |
5 files changed, 94 insertions(+), 1 deletion(-)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
diff --git a/meson.build b/meson.build
|
|
|
ebfe55 |
index 8ef592bc58..2a404857ce 100644
|
|
|
ebfe55 |
--- a/meson.build
|
|
|
ebfe55 |
+++ b/meson.build
|
|
|
ebfe55 |
@@ -117,6 +117,7 @@ xrandr_dep = dependency('xrandr', version: xrandr_req)
|
|
|
ebfe55 |
xcb_randr_dep = dependency('xcb-randr')
|
|
|
ebfe55 |
xcb_res_dep = dependency('xcb-res')
|
|
|
ebfe55 |
xinerama_dep = dependency('xinerama')
|
|
|
ebfe55 |
+xau_dep = dependency('xau')
|
|
|
ebfe55 |
ice_dep = dependency('ice')
|
|
|
ebfe55 |
atk_dep = dependency('atk', version: atk_req)
|
|
|
ebfe55 |
libcanberra_dep = dependency('libcanberra', version: libcanberra_req)
|
|
|
ebfe55 |
diff --git a/src/meson.build b/src/meson.build
|
|
|
ebfe55 |
index 7cced8f534..91fe74b99a 100644
|
|
|
ebfe55 |
--- a/src/meson.build
|
|
|
ebfe55 |
+++ b/src/meson.build
|
|
|
ebfe55 |
@@ -101,6 +101,7 @@ if have_x11
|
|
|
ebfe55 |
x11_xcb_dep,
|
|
|
ebfe55 |
xcb_randr_dep,
|
|
|
ebfe55 |
xcb_res_dep,
|
|
|
ebfe55 |
+ xau_dep,
|
|
|
ebfe55 |
]
|
|
|
ebfe55 |
|
|
|
ebfe55 |
if have_sm
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
|
|
|
ebfe55 |
index 07a71f82b1..5bcb0ea4f9 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-wayland-private.h
|
|
|
ebfe55 |
+++ b/src/wayland/meta-wayland-private.h
|
|
|
ebfe55 |
@@ -51,6 +51,7 @@ typedef struct
|
|
|
ebfe55 |
struct wl_client *client;
|
|
|
ebfe55 |
struct wl_resource *xserver_resource;
|
|
|
ebfe55 |
char *display_name;
|
|
|
ebfe55 |
+ char *auth_file;
|
|
|
ebfe55 |
|
|
|
ebfe55 |
GCancellable *xserver_died_cancellable;
|
|
|
ebfe55 |
GSubprocess *proc;
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
|
|
|
ebfe55 |
index a593f0a7b7..129da8e20d 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-wayland.c
|
|
|
ebfe55 |
+++ b/src/wayland/meta-wayland.c
|
|
|
ebfe55 |
@@ -362,6 +362,12 @@ meta_wayland_override_display_name (const char *display_name)
|
|
|
ebfe55 |
_display_name_override = g_strdup (display_name);
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
+static const char *
|
|
|
ebfe55 |
+meta_wayland_get_xwayland_auth_file (MetaWaylandCompositor *compositor)
|
|
|
ebfe55 |
+{
|
|
|
ebfe55 |
+ return compositor->xwayland_manager.auth_file;
|
|
|
ebfe55 |
+}
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
meta_wayland_init (void)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
@@ -439,7 +445,10 @@ meta_wayland_init (void)
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
if (meta_should_autostart_x11_display ())
|
|
|
ebfe55 |
- set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
|
|
|
ebfe55 |
+ set_gnome_env ("XAUTHORITY", meta_wayland_get_xwayland_auth_file (compositor));
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
|
|
|
ebfe55 |
set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
index f3df9766ee..c883eb3d6f 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
@@ -32,6 +32,9 @@
|
|
|
ebfe55 |
#include <sys/socket.h>
|
|
|
ebfe55 |
#include <sys/stat.h>
|
|
|
ebfe55 |
#include <sys/un.h>
|
|
|
ebfe55 |
+#include <sys/random.h>
|
|
|
ebfe55 |
+#include <unistd.h>
|
|
|
ebfe55 |
+#include <X11/Xauth.h>
|
|
|
ebfe55 |
|
|
|
ebfe55 |
#include "compositor/meta-surface-actor-wayland.h"
|
|
|
ebfe55 |
#include "meta/main.h"
|
|
|
ebfe55 |
@@ -525,6 +528,75 @@ choose_xdisplay (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
return TRUE;
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FILE, fclose)
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+static gboolean
|
|
|
ebfe55 |
+prepare_auth_file (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
+{
|
|
|
ebfe55 |
+ Xauth auth_entry = { 0 };
|
|
|
ebfe55 |
+ g_autoptr (FILE) fp = NULL;
|
|
|
ebfe55 |
+ char hostname[HOST_NAME_MAX + 1];
|
|
|
ebfe55 |
+ char auth_data[16];
|
|
|
ebfe55 |
+ int fd;
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ manager->auth_file = g_build_filename (g_get_user_runtime_dir (),
|
|
|
ebfe55 |
+ ".mutter-Xwaylandauth.XXXXXX",
|
|
|
ebfe55 |
+ NULL);
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ if (gethostname (hostname, HOST_NAME_MAX) < 0)
|
|
|
ebfe55 |
+ g_strlcpy (hostname, "localhost", HOST_NAME_MAX);
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ if (getrandom (auth_data, sizeof (auth_data), 0) != sizeof (auth_data))
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ g_warning ("Failed to get random data: %s", g_strerror (errno));
|
|
|
ebfe55 |
+ return FALSE;
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ auth_entry.family = FamilyLocal;
|
|
|
ebfe55 |
+ auth_entry.address = hostname;
|
|
|
ebfe55 |
+ auth_entry.address_length = strlen (auth_entry.address);
|
|
|
ebfe55 |
+ auth_entry.name = (char *) "MIT-MAGIC-COOKIE-1";
|
|
|
ebfe55 |
+ auth_entry.name_length = strlen (auth_entry.name);
|
|
|
ebfe55 |
+ auth_entry.data = auth_data;
|
|
|
ebfe55 |
+ auth_entry.data_length = sizeof (auth_data);
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ fd = g_mkstemp (manager->auth_file);
|
|
|
ebfe55 |
+ if (fd < 0)
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ g_warning ("Failed to open Xauthority file: %s", g_strerror (errno));
|
|
|
ebfe55 |
+ return FALSE;
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ fp = fdopen (fd, "w+");
|
|
|
ebfe55 |
+ if (!fp)
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ g_warning ("Failed to open Xauthority stream: %s", g_strerror (errno));
|
|
|
ebfe55 |
+ close (fd);
|
|
|
ebfe55 |
+ return FALSE;
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ if (!XauWriteAuth (fp, &auth_entry))
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ g_warning ("Error writing to Xauthority file: %s", g_strerror (errno));
|
|
|
ebfe55 |
+ return FALSE;
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ auth_entry.family = FamilyWild;
|
|
|
ebfe55 |
+ if (!XauWriteAuth (fp, &auth_entry))
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ g_warning ("Error writing to Xauthority file: %s", g_strerror (errno));
|
|
|
ebfe55 |
+ return FALSE;
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ if (fflush (fp) == EOF)
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ g_warning ("Error writing to Xauthority file: %s", g_strerror (errno));
|
|
|
ebfe55 |
+ return FALSE;
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ return TRUE;
|
|
|
ebfe55 |
+}
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
static void
|
|
|
ebfe55 |
xserver_finished_init (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
@@ -566,6 +638,9 @@ meta_xwayland_start (MetaXWaylandManager *manager,
|
|
|
ebfe55 |
if (!choose_xdisplay (manager))
|
|
|
ebfe55 |
goto out;
|
|
|
ebfe55 |
|
|
|
ebfe55 |
+ if (!prepare_auth_file (manager))
|
|
|
ebfe55 |
+ goto out;
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
/* We want xwayland to be a wayland client so we make a socketpair to setup a
|
|
|
ebfe55 |
* wayland protocol connection. */
|
|
|
ebfe55 |
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, xwayland_client_fd) < 0)
|
|
|
ebfe55 |
@@ -610,6 +685,7 @@ meta_xwayland_start (MetaXWaylandManager *manager,
|
|
|
ebfe55 |
"-terminate",
|
|
|
ebfe55 |
"-accessx",
|
|
|
ebfe55 |
"-core",
|
|
|
ebfe55 |
+ "-auth", manager->auth_file,
|
|
|
ebfe55 |
"-listen", "4",
|
|
|
ebfe55 |
"-listen", "5",
|
|
|
ebfe55 |
"-displayfd", "6",
|
|
|
ebfe55 |
@@ -678,6 +754,11 @@ meta_xwayland_stop (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
unlink (path);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
g_clear_pointer (&manager->display_name, g_free);
|
|
|
ebfe55 |
+ if (manager->auth_file)
|
|
|
ebfe55 |
+ {
|
|
|
ebfe55 |
+ unlink (manager->auth_file);
|
|
|
ebfe55 |
+ g_clear_pointer (&manager->auth_file, g_free);
|
|
|
ebfe55 |
+ }
|
|
|
ebfe55 |
if (manager->lock_file)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
unlink (manager->lock_file);
|
|
|
ebfe55 |
--
|
|
|
ebfe55 |
2.31.1
|
|
|
ebfe55 |
|
|
|
ebfe55 |
|
|
|
ebfe55 |
From fdf6969cf89dc9127fc9f4d03d9408e54ccd1b40 Mon Sep 17 00:00:00 2001
|
|
|
ebfe55 |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
ebfe55 |
Date: Mon, 19 Aug 2019 15:36:32 +0200
|
|
|
ebfe55 |
Subject: [PATCH 2/4] xwayland: pass the X11 display
|
|
|
ebfe55 |
|
|
|
ebfe55 |
Pass the X11 display to `meta_xwayland_complete_init()` so that it can
|
|
|
ebfe55 |
be used without poking into GDK.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
|
|
|
ebfe55 |
---
|
|
|
ebfe55 |
src/wayland/meta-xwayland-private.h | 3 ++-
|
|
|
ebfe55 |
src/wayland/meta-xwayland.c | 3 ++-
|
|
|
ebfe55 |
src/x11/meta-x11-display.c | 5 ++---
|
|
|
ebfe55 |
3 files changed, 6 insertions(+), 5 deletions(-)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
|
|
|
ebfe55 |
index 38874eda3f..abcb09e49b 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland-private.h
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland-private.h
|
|
|
ebfe55 |
@@ -29,7 +29,8 @@ meta_xwayland_start (MetaXWaylandManager *manager,
|
|
|
ebfe55 |
struct wl_display *display);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
-meta_xwayland_complete_init (MetaDisplay *display);
|
|
|
ebfe55 |
+meta_xwayland_complete_init (MetaDisplay *display,
|
|
|
ebfe55 |
+ Display *xdisplay);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
meta_xwayland_stop (MetaXWaylandManager *manager);
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
index c883eb3d6f..350626dfdb 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
@@ -727,7 +727,8 @@ on_x11_display_closing (MetaDisplay *display)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
/* To be called right after connecting */
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
-meta_xwayland_complete_init (MetaDisplay *display)
|
|
|
ebfe55 |
+meta_xwayland_complete_init (MetaDisplay *display,
|
|
|
ebfe55 |
+ Display *xdisplay)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
/* We install an X IO error handler in addition to the child watch,
|
|
|
ebfe55 |
because after Xlib connects our child watch may not be called soon
|
|
|
ebfe55 |
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
|
|
|
ebfe55 |
index 065ffcdda5..d40dcfa3f8 100644
|
|
|
ebfe55 |
--- a/src/x11/meta-x11-display.c
|
|
|
ebfe55 |
+++ b/src/x11/meta-x11-display.c
|
|
|
ebfe55 |
@@ -1066,14 +1066,13 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
g_assert (prepared_gdk_display);
|
|
|
ebfe55 |
gdk_display = g_steal_pointer (&prepared_gdk_display);
|
|
|
ebfe55 |
+ xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
#ifdef HAVE_WAYLAND
|
|
|
ebfe55 |
if (meta_is_wayland_compositor ())
|
|
|
ebfe55 |
- meta_xwayland_complete_init (display);
|
|
|
ebfe55 |
+ meta_xwayland_complete_init (display, xdisplay);
|
|
|
ebfe55 |
#endif
|
|
|
ebfe55 |
|
|
|
ebfe55 |
- xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display);
|
|
|
ebfe55 |
-
|
|
|
ebfe55 |
if (meta_is_syncing ())
|
|
|
ebfe55 |
XSynchronize (xdisplay, True);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
--
|
|
|
ebfe55 |
2.31.1
|
|
|
ebfe55 |
|
|
|
ebfe55 |
|
|
|
ebfe55 |
From 25a0945aa69c479d6356a970b39e6ae42e43c877 Mon Sep 17 00:00:00 2001
|
|
|
ebfe55 |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
ebfe55 |
Date: Mon, 19 Aug 2019 15:48:17 +0200
|
|
|
ebfe55 |
Subject: [PATCH 3/4] xwayland: Use given X11 display for DnD setup
|
|
|
ebfe55 |
|
|
|
ebfe55 |
Use the provided X11 display instead of poking into GDK to get the X11
|
|
|
ebfe55 |
display.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
|
|
|
ebfe55 |
---
|
|
|
ebfe55 |
src/wayland/meta-xwayland-private.h | 4 ++--
|
|
|
ebfe55 |
src/wayland/meta-xwayland-selection.c | 18 +++++++++---------
|
|
|
ebfe55 |
src/wayland/meta-xwayland.c | 7 +++++--
|
|
|
ebfe55 |
3 files changed, 16 insertions(+), 13 deletions(-)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
|
|
|
ebfe55 |
index abcb09e49b..f562d7c96d 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland-private.h
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland-private.h
|
|
|
ebfe55 |
@@ -36,8 +36,8 @@ void
|
|
|
ebfe55 |
meta_xwayland_stop (MetaXWaylandManager *manager);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
/* wl_data_device/X11 selection interoperation */
|
|
|
ebfe55 |
-void meta_xwayland_init_selection (void);
|
|
|
ebfe55 |
-void meta_xwayland_shutdown_selection (void);
|
|
|
ebfe55 |
+void meta_xwayland_init_selection (Display *xdisplay);
|
|
|
ebfe55 |
+void meta_xwayland_shutdown_selection (Display *xdisplay);
|
|
|
ebfe55 |
gboolean meta_xwayland_selection_handle_event (XEvent *xevent);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void);
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
|
|
|
ebfe55 |
index 808f913339..122bb76e1c 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland-selection.c
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland-selection.c
|
|
|
ebfe55 |
@@ -353,9 +353,9 @@ xdnd_send_status (MetaXWaylandSelection *selection_data,
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
static void
|
|
|
ebfe55 |
-meta_xwayland_init_dnd (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
+meta_xwayland_init_dnd (MetaXWaylandManager *manager,
|
|
|
ebfe55 |
+ Display *xdisplay)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
- Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
ebfe55 |
MetaDndBridge *dnd = &manager->selection_data->dnd;
|
|
|
ebfe55 |
XSetWindowAttributes attributes;
|
|
|
ebfe55 |
guint32 i, version = XDND_VERSION;
|
|
|
ebfe55 |
@@ -382,12 +382,12 @@ meta_xwayland_init_dnd (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
static void
|
|
|
ebfe55 |
-meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
+meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
|
|
|
ebfe55 |
+ Display *xdisplay)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
MetaDndBridge *dnd = &manager->selection_data->dnd;
|
|
|
ebfe55 |
|
|
|
ebfe55 |
- XDestroyWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
|
|
ebfe55 |
- dnd->dnd_window);
|
|
|
ebfe55 |
+ XDestroyWindow (xdisplay, dnd->dnd_window);
|
|
|
ebfe55 |
dnd->dnd_window = None;
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
@@ -1755,7 +1755,7 @@ shutdown_selection_bridge (MetaSelectionBridge *selection)
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
-meta_xwayland_init_selection (void)
|
|
|
ebfe55 |
+meta_xwayland_init_selection (Display *xdisplay)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
|
|
ebfe55 |
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
|
|
ebfe55 |
@@ -1764,7 +1764,7 @@ meta_xwayland_init_selection (void)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
manager->selection_data = g_slice_new0 (MetaXWaylandSelection);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
- meta_xwayland_init_dnd (manager);
|
|
|
ebfe55 |
+ meta_xwayland_init_dnd (manager, xdisplay);
|
|
|
ebfe55 |
init_selection_bridge (&manager->selection_data->clipboard,
|
|
|
ebfe55 |
gdk_x11_get_xatom_by_name ("CLIPBOARD"),
|
|
|
ebfe55 |
&compositor->seat->data_device.selection_ownership_signal);
|
|
|
ebfe55 |
@@ -1777,7 +1777,7 @@ meta_xwayland_init_selection (void)
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
-meta_xwayland_shutdown_selection (void)
|
|
|
ebfe55 |
+meta_xwayland_shutdown_selection (Display *xdisplay)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
|
|
ebfe55 |
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
|
|
ebfe55 |
@@ -1787,7 +1787,7 @@ meta_xwayland_shutdown_selection (void)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
g_clear_object (&selection->clipboard.source);
|
|
|
ebfe55 |
|
|
|
ebfe55 |
- meta_xwayland_shutdown_dnd (manager);
|
|
|
ebfe55 |
+ meta_xwayland_shutdown_dnd (manager, xdisplay);
|
|
|
ebfe55 |
shutdown_selection_bridge (&selection->clipboard);
|
|
|
ebfe55 |
shutdown_selection_bridge (&selection->primary);
|
|
|
ebfe55 |
shutdown_selection_bridge (&selection->dnd.selection);
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
index 350626dfdb..3236711482 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
@@ -38,6 +38,7 @@
|
|
|
ebfe55 |
|
|
|
ebfe55 |
#include "compositor/meta-surface-actor-wayland.h"
|
|
|
ebfe55 |
#include "meta/main.h"
|
|
|
ebfe55 |
+#include "meta/meta-x11-display.h"
|
|
|
ebfe55 |
#include "wayland/meta-wayland-actor-surface.h"
|
|
|
ebfe55 |
|
|
|
ebfe55 |
enum
|
|
|
ebfe55 |
@@ -722,7 +723,9 @@ out:
|
|
|
ebfe55 |
static void
|
|
|
ebfe55 |
on_x11_display_closing (MetaDisplay *display)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
- meta_xwayland_shutdown_selection ();
|
|
|
ebfe55 |
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ meta_xwayland_shutdown_selection (xdisplay);
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
/* To be called right after connecting */
|
|
|
ebfe55 |
@@ -739,7 +742,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
|
|
|
ebfe55 |
|
|
|
ebfe55 |
g_signal_connect (display, "x11-display-closing",
|
|
|
ebfe55 |
G_CALLBACK (on_x11_display_closing), NULL);
|
|
|
ebfe55 |
- meta_xwayland_init_selection ();
|
|
|
ebfe55 |
+ meta_xwayland_init_selection (xdisplay);
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
--
|
|
|
ebfe55 |
2.31.1
|
|
|
ebfe55 |
|
|
|
ebfe55 |
|
|
|
ebfe55 |
From a398699a53b9cc6efda4aa8abe0e3176bab80e92 Mon Sep 17 00:00:00 2001
|
|
|
ebfe55 |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
ebfe55 |
Date: Mon, 19 Aug 2019 15:50:54 +0200
|
|
|
ebfe55 |
Subject: [PATCH 4/4] xwayland: Add local user to xhost
|
|
|
ebfe55 |
|
|
|
ebfe55 |
With the addition of xauth support (commit a8984a81c), Xwayland would
|
|
|
ebfe55 |
rely only on the provided cookies for authentication.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
As a result, running an Xclient from another VT (hence without the
|
|
|
ebfe55 |
XAUTHORITY environment variable set) would result in an access denied.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
The same on X11 is granted because the local user is automatically
|
|
|
ebfe55 |
granted access to Xserver by the startup scripts.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
Add the local user to xhost at startup on Xwayland so that the user can
|
|
|
ebfe55 |
still run a client by setting the DISPLAY as long as it's the same user
|
|
|
ebfe55 |
on the same host.
|
|
|
ebfe55 |
|
|
|
ebfe55 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
|
|
|
ebfe55 |
---
|
|
|
ebfe55 |
src/wayland/meta-xwayland.c | 18 ++++++++++++++++++
|
|
|
ebfe55 |
1 file changed, 18 insertions(+)
|
|
|
ebfe55 |
|
|
|
ebfe55 |
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
index 3236711482..275aeb78cb 100644
|
|
|
ebfe55 |
--- a/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
+++ b/src/wayland/meta-xwayland.c
|
|
|
ebfe55 |
@@ -598,6 +598,23 @@ prepare_auth_file (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
return TRUE;
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
+static void
|
|
|
ebfe55 |
+add_local_user_to_xhost (Display *xdisplay)
|
|
|
ebfe55 |
+{
|
|
|
ebfe55 |
+ XHostAddress host_entry;
|
|
|
ebfe55 |
+ XServerInterpretedAddress siaddr;
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ siaddr.type = (char *) "localuser";
|
|
|
ebfe55 |
+ siaddr.typelength = strlen (siaddr.type);
|
|
|
ebfe55 |
+ siaddr.value = (char *) g_get_user_name();
|
|
|
ebfe55 |
+ siaddr.valuelength = strlen (siaddr.value);
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ host_entry.family = FamilyServerInterpreted;
|
|
|
ebfe55 |
+ host_entry.address = (char *) &siaddr;
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
+ XAddHost (xdisplay, &host_entry);
|
|
|
ebfe55 |
+}
|
|
|
ebfe55 |
+
|
|
|
ebfe55 |
static void
|
|
|
ebfe55 |
xserver_finished_init (MetaXWaylandManager *manager)
|
|
|
ebfe55 |
{
|
|
|
ebfe55 |
@@ -743,6 +760,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
|
|
|
ebfe55 |
g_signal_connect (display, "x11-display-closing",
|
|
|
ebfe55 |
G_CALLBACK (on_x11_display_closing), NULL);
|
|
|
ebfe55 |
meta_xwayland_init_selection (xdisplay);
|
|
|
ebfe55 |
+ add_local_user_to_xhost (xdisplay);
|
|
|
ebfe55 |
}
|
|
|
ebfe55 |
|
|
|
ebfe55 |
void
|
|
|
ebfe55 |
--
|
|
|
ebfe55 |
2.31.1
|
|
|
ebfe55 |
|