[gtk: 2/3] gdkdrop-x11: Use the preferred action if possible
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 2/3] gdkdrop-x11: Use the preferred action if possible
- Date: Sat, 16 Jul 2022 21:37:16 +0000 (UTC)
commit 16fd2608fdf8765a7d53ae9ecaeb3dacbbc96d89
Author: Corey Berla <corey berla me>
Date: Sat Jul 16 13:34:07 2022 -0700
gdkdrop-x11: Use the preferred action if possible
The XDND suggested action is a relic from when the source would control
the action for a drop. With the new GtkDropTarget the target decides
the action (not the source). That means the all of the returned
results from the ::enter and ::motion handlers will be unexpectely
ignored. Prefer to use the preferred action over the x11 suggested action.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4259
gdk/x11/gdkdrop-x11.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index 3f7566d88d..05b07ca990 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -769,22 +769,18 @@ gdk_x11_drop_status (GdkDrop *drop,
possible_actions = actions & gdk_drop_get_actions (drop);
- if (drop_x11->suggested_action != 0)
+ if (preferred & possible_actions)
+ suggested_action = preferred;
+ else if (drop_x11->suggested_action & possible_actions)
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 = preferred & possible_actions;
-
- if (suggested_action == 0 && possible_actions != 0)
- {
- 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;
- }
+ suggested_action = 0;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]