xwayland: Init/shutdown DND using MetaX11Display

Before it was passed an Display pointer, and had to e.g. fetch the root
window from GDK instead of the MetaX11Display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
This commit is contained in:
Jonas Ådahl 2021-03-23 16:57:00 +01:00
parent b4fe1fdd95
commit fb78ac4016
3 changed files with 10 additions and 9 deletions

View File

@ -942,10 +942,11 @@ meta_xwayland_dnd_handle_event (XEvent *xevent)
} }
void void
meta_xwayland_init_dnd (Display *xdisplay) meta_xwayland_init_dnd (MetaX11Display *x11_display)
{ {
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 = meta_x11_display_get_xdisplay (x11_display);
MetaXWaylandDnd *dnd = manager->dnd; MetaXWaylandDnd *dnd = manager->dnd;
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
guint32 i, version = XDND_VERSION; guint32 i, version = XDND_VERSION;
@ -961,7 +962,7 @@ meta_xwayland_init_dnd (Display *xdisplay)
attributes.override_redirect = True; attributes.override_redirect = True;
dnd->dnd_window = XCreateWindow (xdisplay, dnd->dnd_window = XCreateWindow (xdisplay,
gdk_x11_window_get_xid (gdk_get_default_root_window ()), meta_x11_display_get_xroot (x11_display),
-1, -1, 1, 1, -1, -1, 1, 1,
0, /* border width */ 0, /* border width */
0, /* depth */ 0, /* depth */
@ -977,13 +978,13 @@ meta_xwayland_init_dnd (Display *xdisplay)
void void
meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager, meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
Display *xdisplay) MetaX11Display *x11_display)
{ {
MetaXWaylandDnd *dnd = manager->dnd; MetaXWaylandDnd *dnd = manager->dnd;
g_assert (dnd != NULL); g_assert (dnd != NULL);
XDestroyWindow (xdisplay, dnd->dnd_window); XDestroyWindow (meta_x11_display_get_xdisplay (x11_display), dnd->dnd_window);
dnd->dnd_window = None; dnd->dnd_window = None;
g_free (dnd); g_free (dnd);

View File

@ -45,9 +45,9 @@ gboolean
meta_xwayland_handle_xevent (XEvent *event); meta_xwayland_handle_xevent (XEvent *event);
/* wl_data_device/X11 selection interoperation */ /* wl_data_device/X11 selection interoperation */
void meta_xwayland_init_dnd (Display *xdisplay); void meta_xwayland_init_dnd (MetaX11Display *x11_display);
void meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager, void meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
Display *xdisplay); MetaX11Display *x11_display);
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

@ -1218,9 +1218,9 @@ static void
on_x11_display_closing (MetaDisplay *display, on_x11_display_closing (MetaDisplay *display,
MetaXWaylandManager *manager) MetaXWaylandManager *manager)
{ {
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display); MetaX11Display *x11_display = meta_display_get_x11_display (display);
meta_xwayland_shutdown_dnd (manager, xdisplay); meta_xwayland_shutdown_dnd (manager, x11_display);
g_signal_handlers_disconnect_by_func (meta_monitor_manager_get (), g_signal_handlers_disconnect_by_func (meta_monitor_manager_get (),
monitors_changed_cb, monitors_changed_cb,
NULL); NULL);
@ -1263,7 +1263,7 @@ on_x11_display_setup (MetaDisplay *display,
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display); Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
MetaX11DisplayPolicy x11_display_policy; MetaX11DisplayPolicy x11_display_policy;
meta_xwayland_init_dnd (xdisplay); meta_xwayland_init_dnd (x11_display);
meta_xwayland_init_xrandr (manager, xdisplay); meta_xwayland_init_xrandr (manager, xdisplay);
meta_xwayland_stop_xserver_timeout (manager); meta_xwayland_stop_xserver_timeout (manager);