From bc166aa6b44bd08714cfe42430741a3ad18b8c9c Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 19 Aug 2019 15:48:17 +0200 Subject: [PATCH] xwayland: Use given X11 display for DnD setup Use the provided X11 display instead of poking into GDK to get the X11 display. https://gitlab.gnome.org/GNOME/mutter/merge_requests/735 --- src/wayland/meta-xwayland-dnd.c | 8 +++----- src/wayland/meta-xwayland-private.h | 4 ++-- src/wayland/meta-xwayland.c | 6 ++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c index 15f23fbda..3ad58e4d2 100644 --- a/src/wayland/meta-xwayland-dnd.c +++ b/src/wayland/meta-xwayland-dnd.c @@ -896,11 +896,10 @@ meta_xwayland_dnd_handle_event (XEvent *xevent) } void -meta_xwayland_init_dnd (void) +meta_xwayland_init_dnd (Display *xdisplay) { MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaXWaylandManager *manager = &compositor->xwayland_manager; - Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); MetaXWaylandDnd *dnd = manager->dnd; XSetWindowAttributes attributes; guint32 i, version = XDND_VERSION; @@ -931,7 +930,7 @@ meta_xwayland_init_dnd (void) } void -meta_xwayland_shutdown_dnd (void) +meta_xwayland_shutdown_dnd (Display *xdisplay) { MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaXWaylandManager *manager = &compositor->xwayland_manager; @@ -939,8 +938,7 @@ meta_xwayland_shutdown_dnd (void) g_assert (dnd != NULL); - XDestroyWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), - dnd->dnd_window); + XDestroyWindow (xdisplay, dnd->dnd_window); dnd->dnd_window = None; g_slice_free (MetaXWaylandDnd, dnd); diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h index 481cffd22..75cd04715 100644 --- a/src/wayland/meta-xwayland-private.h +++ b/src/wayland/meta-xwayland-private.h @@ -36,8 +36,8 @@ void meta_xwayland_shutdown (MetaXWaylandManager *manager); /* wl_data_device/X11 selection interoperation */ -void meta_xwayland_init_dnd (void); -void meta_xwayland_shutdown_dnd (void); +void meta_xwayland_init_dnd (Display *xdisplay); +void meta_xwayland_shutdown_dnd (Display *xdisplay); gboolean meta_xwayland_dnd_handle_event (XEvent *xevent); const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void); diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index 1ba3e00c2..a7b44453a 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -782,7 +782,9 @@ meta_xwayland_init (MetaXWaylandManager *manager, static void on_x11_display_closing (MetaDisplay *display) { - meta_xwayland_shutdown_dnd (); + Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display); + + meta_xwayland_shutdown_dnd (xdisplay); g_signal_handlers_disconnect_by_func (display, on_x11_display_closing, NULL); @@ -805,7 +807,7 @@ meta_xwayland_complete_init (MetaDisplay *display, g_signal_connect (display, "x11-display-closing", G_CALLBACK (on_x11_display_closing), NULL); - meta_xwayland_init_dnd (); + meta_xwayland_init_dnd (xdisplay); if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND) {