[gtk/cherry-pick-09da4db8] Merge branch 'dnd' into 'main'
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/cherry-pick-09da4db8] Merge branch 'dnd' into 'main'
- Date: Mon, 18 Jul 2022 14:21:56 +0000 (UTC)
commit 45ff81848faf25fae18a09e6b0def6c7114a470b
Author: Benjamin Otte <otte benjamin googlemail com>
Date: Sat Jul 16 21:37:15 2022 +0000
Merge branch 'dnd' into 'main'
DnD Fix Preferred Action for X11
Closes #4259
See merge request GNOME/gtk!4785
(cherry picked from commit 09da4db81f8f69bb47cf7f942cea1d272df6e76f)
c9c48d78 gdkdrop-x11: Fix preferred action
16fd2608 gdkdrop-x11: Use the preferred action if possible
gdk/x11/gdkdrop-x11.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index 91987fad13..05b07ca990 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -361,9 +361,9 @@ gdk_x11_drop_update_actions (GdkX11Drop *drop_x11)
if (!drop_x11->xdnd_have_actions)
actions = drop_x11->suggested_action;
else if (drop_x11->suggested_action & GDK_ACTION_ASK)
- actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
+ actions = drop_x11->xdnd_actions | GDK_ACTION_ASK;
else
- actions = drop_x11->suggested_action;
+ actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
gdk_drop_set_actions (GDK_DROP (drop_x11), actions);
}
@@ -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]