x11: Change the way local Drop => Drag is shortcut
This is one step further towards untangling drag and drop parts of X11 DND.
This commit is contained in:
@@ -2330,39 +2330,58 @@ gdk_x11_drag_context_drag_drop (GdkDragContext *context,
|
|||||||
|
|
||||||
/* Destination side */
|
/* Destination side */
|
||||||
|
|
||||||
|
static void
|
||||||
|
gdk_x11_drop_do_nothing (Window window,
|
||||||
|
gboolean success,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GdkDisplay *display = data;
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_NOTE (display, DND,
|
||||||
|
g_message ("Send event to %lx failed",
|
||||||
|
window));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_x11_drag_context_status (GdkDrop *drop,
|
gdk_x11_drag_context_status (GdkDrop *drop,
|
||||||
GdkDragAction actions)
|
GdkDragAction actions)
|
||||||
{
|
{
|
||||||
GdkDragContext *context = GDK_DRAG_CONTEXT (drop);
|
GdkDragContext *context = GDK_DRAG_CONTEXT (drop);
|
||||||
GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
|
GdkDragAction possible_actions;
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
display = gdk_drag_context_get_display (context);
|
display = gdk_drag_context_get_display (context);
|
||||||
|
|
||||||
context->action = actions;
|
context->action = actions;
|
||||||
|
possible_actions = actions & gdk_drop_get_actions (drop);
|
||||||
|
|
||||||
if (context_x11->protocol == GDK_DRAG_PROTO_XDND)
|
xev.xclient.type = ClientMessage;
|
||||||
|
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
|
||||||
|
xev.xclient.format = 32;
|
||||||
|
xev.xclient.window = GDK_SURFACE_XID (context->source_surface);
|
||||||
|
|
||||||
|
xev.xclient.data.l[0] = GDK_SURFACE_XID (context->dest_surface);
|
||||||
|
xev.xclient.data.l[1] = (possible_actions != 0) ? (2 | 1) : 0;
|
||||||
|
xev.xclient.data.l[2] = 0;
|
||||||
|
xev.xclient.data.l[3] = 0;
|
||||||
|
xev.xclient.data.l[4] = xdnd_action_to_atom (display, possible_actions);
|
||||||
|
|
||||||
|
if (gdk_drop_get_drag (drop))
|
||||||
{
|
{
|
||||||
GdkDragAction possible_actions = actions & gdk_drop_get_actions (drop);
|
xdnd_status_filter (context->source_surface, &xev);
|
||||||
|
}
|
||||||
xev.xclient.type = ClientMessage;
|
else
|
||||||
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
|
{
|
||||||
xev.xclient.format = 32;
|
_gdk_x11_send_client_message_async (display,
|
||||||
xev.xclient.window = GDK_SURFACE_XID (context->source_surface);
|
GDK_SURFACE_XID (context->source_surface),
|
||||||
|
FALSE, 0,
|
||||||
xev.xclient.data.l[0] = GDK_SURFACE_XID (context->dest_surface);
|
&xev.xclient,
|
||||||
xev.xclient.data.l[1] = (possible_actions != 0) ? (2 | 1) : 0;
|
gdk_x11_drop_do_nothing,
|
||||||
xev.xclient.data.l[2] = 0;
|
display);
|
||||||
xev.xclient.data.l[3] = 0;
|
|
||||||
xev.xclient.data.l[4] = xdnd_action_to_atom (display, possible_actions);
|
|
||||||
if (!xdnd_send_xevent (context_x11, context->source_surface, &xev))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_NOTE (display, DND,
|
|
||||||
g_message ("Send event to %lx failed",
|
|
||||||
GDK_SURFACE_XID (context->source_surface)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2406,11 +2425,18 @@ gdk_x11_drag_context_finish (GdkDrop *drop,
|
|||||||
xev.xclient.data.l[3] = 0;
|
xev.xclient.data.l[3] = 0;
|
||||||
xev.xclient.data.l[4] = 0;
|
xev.xclient.data.l[4] = 0;
|
||||||
|
|
||||||
if (!xdnd_send_xevent (GDK_X11_DRAG_CONTEXT (context), context->source_surface, &xev))
|
if (gdk_drop_get_drag (drop))
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_NOTE (display, DND,
|
xdnd_finished_filter (context->source_surface, &xev);
|
||||||
g_message ("Send event to %lx failed",
|
}
|
||||||
GDK_SURFACE_XID (context->source_surface)));
|
else
|
||||||
|
{
|
||||||
|
_gdk_x11_send_client_message_async (display,
|
||||||
|
GDK_SURFACE_XID (context->source_surface),
|
||||||
|
FALSE, 0,
|
||||||
|
&xev.xclient,
|
||||||
|
gdk_x11_drop_do_nothing,
|
||||||
|
display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user