[mutter] Fix XDND handling to work without GDK and MetaX11Display



commit 43f9cd537ea0a9c25fe1e71983343a6e8afadbe1
Author: Armin Krezović <krezovic armin gmail com>
Date:   Sat Aug 26 22:52:21 2017 +0200

    Fix XDND handling to work without GDK and MetaX11Display
    
    This fixes mutter --nested --wayland without X11
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759538

 src/backends/meta-dnd-private.h     |  2 +-
 src/backends/x11/meta-backend-x11.c |  2 +-
 src/compositor/meta-dnd.c           | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/backends/meta-dnd-private.h b/src/backends/meta-dnd-private.h
index 6fb17f26f..b2ff90cfb 100644
--- a/src/backends/meta-dnd-private.h
+++ b/src/backends/meta-dnd-private.h
@@ -24,7 +24,7 @@
 
 gboolean meta_dnd_handle_xdnd_event (MetaBackend    *backend,
                                      MetaCompositor *compositor,
-                                     MetaDisplay    *display,
+                                     Display        *xdisplay,
                                      XEvent         *xev);
 
 #ifdef HAVE_WAYLAND
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index 458ac92b0..7d7910345 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -332,7 +332,7 @@ handle_host_xevent (MetaBackend *backend,
         if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event))
           bypass_clutter = TRUE;
 
-        if (meta_dnd_handle_xdnd_event (backend, compositor, display, event))
+        if (meta_dnd_handle_xdnd_event (backend, compositor, priv->xdisplay, event))
           bypass_clutter = TRUE;
       }
   }
diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c
index a30f5be7c..467aec347 100644
--- a/src/compositor/meta-dnd.c
+++ b/src/compositor/meta-dnd.c
@@ -140,7 +140,7 @@ meta_dnd_notify_dnd_leave (MetaDnd *dnd)
 gboolean
 meta_dnd_handle_xdnd_event (MetaBackend    *backend,
                             MetaCompositor *compositor,
-                            MetaDisplay    *display,
+                            Display        *xdisplay,
                             XEvent         *xev)
 {
   MetaDnd *dnd = meta_backend_get_dnd (backend);
@@ -153,23 +153,23 @@ meta_dnd_handle_xdnd_event (MetaBackend    *backend,
       xev->xany.window != clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
     return FALSE;
 
-  if (xev->xclient.message_type == gdk_x11_get_xatom_by_name ("XdndPosition"))
+  if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
     {
       XEvent xevent;
       Window src = xev->xclient.data.l[0];
 
       memset (&xevent, 0, sizeof(xevent));
       xevent.xany.type = ClientMessage;
-      xevent.xany.display = display->x11_display->xdisplay;
+      xevent.xany.display = xdisplay;
       xevent.xclient.window = src;
-      xevent.xclient.message_type = gdk_x11_get_xatom_by_name ("XdndStatus");
+      xevent.xclient.message_type = XInternAtom (xdisplay, "XdndStatus", TRUE);
       xevent.xclient.format = 32;
       xevent.xclient.data.l[0] = output_window;
       /* flags: bit 0: will we accept the drop? bit 1: do we want more position messages */
       xevent.xclient.data.l[1] = 2;
       xevent.xclient.data.l[4] = None;
 
-      XSendEvent (display->x11_display->xdisplay, src, False, 0, &xevent);
+      XSendEvent (xdisplay, src, False, 0, &xevent);
 
       meta_dnd_notify_dnd_position_change (dnd,
                                             (int)(xev->xclient.data.l[2] >> 16),
@@ -177,13 +177,13 @@ meta_dnd_handle_xdnd_event (MetaBackend    *backend,
 
       return TRUE;
     }
-  else if (xev->xclient.message_type == gdk_x11_get_xatom_by_name ("XdndLeave"))
+  else if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndLeave", TRUE))
     {
       meta_dnd_notify_dnd_leave (dnd);
 
       return TRUE;
     }
-  else if (xev->xclient.message_type == gdk_x11_get_xatom_by_name ("XdndEnter"))
+  else if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndEnter", TRUE))
     {
       meta_dnd_notify_dnd_enter (dnd);
 


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