diff options
author | Benjamin Otte <otte@redhat.com> | 2018-06-13 21:36:23 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-06-18 23:49:52 +0200 |
commit | 005781021e4f210653979fa1be9dc7b8965ce2ec (patch) | |
tree | feb9d9e9c93442ab8ef0f8a4201eafa6664fcb6e /gdk | |
parent | 14f0a255313b41e5c6a6eb025f6b532d1ace58e9 (diff) | |
download | gtk+-005781021e4f210653979fa1be9dc7b8965ce2ec.tar.gz |
x11: Handle events on drag side differently
Instead of using the filters that the drop side uses, handle events in
the event filter installed by the DragContext.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/x11/gdkdnd-x11.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 9361eb5846..be9a90d298 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -173,10 +173,6 @@ static gboolean xdnd_leave_filter (GdkSurface *surface, const XEvent *xevent); static gboolean xdnd_position_filter (GdkSurface *surface, const XEvent *xevent); -static gboolean xdnd_status_filter (GdkSurface *surface, - const XEvent *xevent); -static gboolean xdnd_finished_filter (GdkSurface *surface, - const XEvent *xevent); static gboolean xdnd_drop_filter (GdkSurface *surface, const XEvent *xevent); @@ -199,8 +195,6 @@ static const struct { { "XdndEnter", xdnd_enter_filter }, { "XdndLeave", xdnd_leave_filter }, { "XdndPosition", xdnd_position_filter }, - { "XdndStatus", xdnd_status_filter }, - { "XdndFinished", xdnd_finished_filter }, { "XdndDrop", xdnd_drop_filter }, }; @@ -1041,16 +1035,14 @@ xdnd_action_to_atom (GdkDisplay *display, /* Source side */ static gboolean -xdnd_status_filter (GdkSurface *surface, +xdnd_status_filter (GdkDisplay *display, const XEvent *xevent) { - GdkDisplay *display; guint32 dest_surface = xevent->xclient.data.l[0]; guint32 flags = xevent->xclient.data.l[1]; Atom action = xevent->xclient.data.l[4]; GdkDragContext *context; - display = gdk_surface_get_display (surface); context = gdk_drag_context_find (display, xevent->xclient.window, dest_surface); GDK_DISPLAY_NOTE (display, DND, @@ -1083,15 +1075,13 @@ xdnd_status_filter (GdkSurface *surface, } static gboolean -xdnd_finished_filter (GdkSurface *surface, +xdnd_finished_filter (GdkDisplay *display, const XEvent *xevent) { - GdkDisplay *display; guint32 dest_surface = xevent->xclient.data.l[0]; GdkDragContext *context; GdkX11DragContext *context_x11; - display = gdk_surface_get_display (surface); context = gdk_drag_context_find (display, xevent->xclient.window, dest_surface); GDK_DISPLAY_NOTE (display, DND, @@ -2372,7 +2362,7 @@ gdk_x11_drag_context_status (GdkDrop *drop, if (gdk_drop_get_drag (drop)) { - xdnd_status_filter (context->source_surface, &xev); + xdnd_status_filter (display, &xev); } else { @@ -2427,7 +2417,7 @@ gdk_x11_drag_context_finish (GdkDrop *drop, if (gdk_drop_get_drag (drop)) { - xdnd_finished_filter (context->source_surface, &xev); + xdnd_finished_filter (display, &xev); } else { @@ -2587,6 +2577,14 @@ gdk_x11_drag_context_xevent (GdkDisplay *display, return TRUE; } + case ClientMessage: + if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus")) + return xdnd_status_filter (display, xevent); + else if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished")) + return xdnd_finished_filter (display, xevent); + else + return FALSE; + default: return FALSE; } |