[mutter] xwayland: Init/shutdown DND using MetaX11Display



commit fb78ac401647e46ee437324811e1e99575d057cd
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 23 16:57:00 2021 +0100

    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>

 src/wayland/meta-xwayland-dnd.c     | 9 +++++----
 src/wayland/meta-xwayland-private.h | 4 ++--
 src/wayland/meta-xwayland.c         | 6 +++---
 3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c
index a3148ed950..2b096ef443 100644
--- a/src/wayland/meta-xwayland-dnd.c
+++ b/src/wayland/meta-xwayland-dnd.c
@@ -942,10 +942,11 @@ meta_xwayland_dnd_handle_event (XEvent *xevent)
 }
 
 void
-meta_xwayland_init_dnd (Display *xdisplay)
+meta_xwayland_init_dnd (MetaX11Display *x11_display)
 {
   MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
   MetaXWaylandManager *manager = &compositor->xwayland_manager;
+  Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
   MetaXWaylandDnd *dnd = manager->dnd;
   XSetWindowAttributes attributes;
   guint32 i, version = XDND_VERSION;
@@ -961,7 +962,7 @@ meta_xwayland_init_dnd (Display *xdisplay)
   attributes.override_redirect = True;
 
   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,
                                    0, /* border width */
                                    0, /* depth */
@@ -977,13 +978,13 @@ meta_xwayland_init_dnd (Display *xdisplay)
 
 void
 meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
-                            Display             *xdisplay)
+                            MetaX11Display      *x11_display)
 {
   MetaXWaylandDnd *dnd = manager->dnd;
 
   g_assert (dnd != NULL);
 
-  XDestroyWindow (xdisplay, dnd->dnd_window);
+  XDestroyWindow (meta_x11_display_get_xdisplay (x11_display), dnd->dnd_window);
   dnd->dnd_window = None;
 
   g_free (dnd);
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
index 1efa948159..90f36497c9 100644
--- a/src/wayland/meta-xwayland-private.h
+++ b/src/wayland/meta-xwayland-private.h
@@ -45,9 +45,9 @@ gboolean
 meta_xwayland_handle_xevent (XEvent *event);
 
 /* 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,
-                                 Display             *xdisplay);
+                                 MetaX11Display      *x11_display);
 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 84db7bc668..c0dbe7b096 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -1218,9 +1218,9 @@ static void
 on_x11_display_closing (MetaDisplay         *display,
                         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 (),
                                         monitors_changed_cb,
                                         NULL);
@@ -1263,7 +1263,7 @@ on_x11_display_setup (MetaDisplay         *display,
   Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
   MetaX11DisplayPolicy x11_display_policy;
 
-  meta_xwayland_init_dnd (xdisplay);
+  meta_xwayland_init_dnd (x11_display);
   meta_xwayland_init_xrandr (manager, xdisplay);
   meta_xwayland_stop_xserver_timeout (manager);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]