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
This commit is contained in:
Olivier Fourdan 2019-08-19 15:48:17 +02:00
parent 5fa8b24b2b
commit bc166aa6b4
3 changed files with 9 additions and 9 deletions

View File

@ -896,11 +896,10 @@ meta_xwayland_dnd_handle_event (XEvent *xevent)
} }
void void
meta_xwayland_init_dnd (void) meta_xwayland_init_dnd (Display *xdisplay)
{ {
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager; MetaXWaylandManager *manager = &compositor->xwayland_manager;
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
MetaXWaylandDnd *dnd = manager->dnd; MetaXWaylandDnd *dnd = manager->dnd;
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
guint32 i, version = XDND_VERSION; guint32 i, version = XDND_VERSION;
@ -931,7 +930,7 @@ meta_xwayland_init_dnd (void)
} }
void void
meta_xwayland_shutdown_dnd (void) meta_xwayland_shutdown_dnd (Display *xdisplay)
{ {
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager; MetaXWaylandManager *manager = &compositor->xwayland_manager;
@ -939,8 +938,7 @@ meta_xwayland_shutdown_dnd (void)
g_assert (dnd != NULL); g_assert (dnd != NULL);
XDestroyWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XDestroyWindow (xdisplay, dnd->dnd_window);
dnd->dnd_window);
dnd->dnd_window = None; dnd->dnd_window = None;
g_slice_free (MetaXWaylandDnd, dnd); g_slice_free (MetaXWaylandDnd, dnd);

View File

@ -36,8 +36,8 @@ void
meta_xwayland_shutdown (MetaXWaylandManager *manager); meta_xwayland_shutdown (MetaXWaylandManager *manager);
/* wl_data_device/X11 selection interoperation */ /* wl_data_device/X11 selection interoperation */
void meta_xwayland_init_dnd (void); void meta_xwayland_init_dnd (Display *xdisplay);
void meta_xwayland_shutdown_dnd (void); void meta_xwayland_shutdown_dnd (Display *xdisplay);
gboolean meta_xwayland_dnd_handle_event (XEvent *xevent); gboolean meta_xwayland_dnd_handle_event (XEvent *xevent);
const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void); const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void);

View File

@ -782,7 +782,9 @@ meta_xwayland_init (MetaXWaylandManager *manager,
static void static void
on_x11_display_closing (MetaDisplay *display) 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, g_signal_handlers_disconnect_by_func (display,
on_x11_display_closing, on_x11_display_closing,
NULL); NULL);
@ -805,7 +807,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
g_signal_connect (display, "x11-display-closing", g_signal_connect (display, "x11-display-closing",
G_CALLBACK (on_x11_display_closing), NULL); 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) if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND)
{ {