[gtk/dnd-gestures-2: 93/175] gdk/x11: Forward suggested action (if any) to XdndStatus
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/dnd-gestures-2: 93/175] gdk/x11: Forward suggested action (if any) to XdndStatus
- Date: Wed, 8 Jan 2020 16:45:39 +0000 (UTC)
commit 593563f622be3617cb6e65cc0c5edc3338aba764
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jan 5 20:20:20 2020 +0100
gdk/x11: Forward suggested action (if any) to XdndStatus
Go ahead with the suggested action, so the drag source may update
cursor feedback properly, and eventually result in the correct
action.
gdk/x11/gdkdrop-x11.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index b0d9457b3b..bbf377f898 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -747,7 +747,7 @@ gdk_x11_drop_status (GdkDrop *drop,
GdkDragAction actions)
{
GdkX11Drop *drop_x11 = GDK_X11_DROP (drop);
- GdkDragAction possible_actions;
+ GdkDragAction possible_actions, suggested_action;
XEvent xev;
GdkDisplay *display;
@@ -755,6 +755,17 @@ gdk_x11_drop_status (GdkDrop *drop,
possible_actions = actions & gdk_drop_get_actions (drop);
+ if (drop_x11->suggested_action != 0)
+ suggested_action = drop_x11->suggested_action;
+ else if (possible_actions & GDK_ACTION_COPY)
+ suggested_action = GDK_ACTION_COPY;
+ else if (possible_actions & GDK_ACTION_MOVE)
+ suggested_action = GDK_ACTION_MOVE;
+ else if (possible_actions & GDK_ACTION_ASK)
+ suggested_action = GDK_ACTION_ASK;
+ else
+ suggested_action = 0;
+
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
xev.xclient.format = 32;
@@ -764,7 +775,7 @@ gdk_x11_drop_status (GdkDrop *drop,
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);
+ xev.xclient.data.l[4] = xdnd_action_to_atom (display, suggested_action);
if (gdk_drop_get_drag (drop))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]