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
This commit is contained in:
Armin Krezović 2017-08-26 22:52:21 +02:00 committed by Jonas Ådahl
parent d4c4d6e64d
commit 43f9cd537e
3 changed files with 9 additions and 9 deletions

View File

@ -24,7 +24,7 @@
gboolean meta_dnd_handle_xdnd_event (MetaBackend *backend, gboolean meta_dnd_handle_xdnd_event (MetaBackend *backend,
MetaCompositor *compositor, MetaCompositor *compositor,
MetaDisplay *display, Display *xdisplay,
XEvent *xev); XEvent *xev);
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND

View File

@ -332,7 +332,7 @@ handle_host_xevent (MetaBackend *backend,
if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event)) if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event))
bypass_clutter = TRUE; 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; bypass_clutter = TRUE;
} }
} }

View File

@ -140,7 +140,7 @@ meta_dnd_notify_dnd_leave (MetaDnd *dnd)
gboolean gboolean
meta_dnd_handle_xdnd_event (MetaBackend *backend, meta_dnd_handle_xdnd_event (MetaBackend *backend,
MetaCompositor *compositor, MetaCompositor *compositor,
MetaDisplay *display, Display *xdisplay,
XEvent *xev) XEvent *xev)
{ {
MetaDnd *dnd = meta_backend_get_dnd (backend); 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))) xev->xany.window != clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
return FALSE; 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; XEvent xevent;
Window src = xev->xclient.data.l[0]; Window src = xev->xclient.data.l[0];
memset (&xevent, 0, sizeof(xevent)); memset (&xevent, 0, sizeof(xevent));
xevent.xany.type = ClientMessage; xevent.xany.type = ClientMessage;
xevent.xany.display = display->x11_display->xdisplay; xevent.xany.display = xdisplay;
xevent.xclient.window = src; 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.format = 32;
xevent.xclient.data.l[0] = output_window; xevent.xclient.data.l[0] = output_window;
/* flags: bit 0: will we accept the drop? bit 1: do we want more position messages */ /* 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[1] = 2;
xevent.xclient.data.l[4] = None; 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, meta_dnd_notify_dnd_position_change (dnd,
(int)(xev->xclient.data.l[2] >> 16), (int)(xev->xclient.data.l[2] >> 16),
@ -177,13 +177,13 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
return TRUE; 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); meta_dnd_notify_dnd_leave (dnd);
return TRUE; 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); meta_dnd_notify_dnd_enter (dnd);