[geary: 1/2] Fix for conversation DND copy/move icon bug



commit 2261d0cb64b2c898643a889cf759a84065227fa6
Author: Chris Heywood <15127-creywood users noreply gitlab gnome org>
Date:   Sat Nov 30 14:17:12 2019 +0100

    Fix for conversation DND copy/move icon bug
    
    Fixes bug brought in with folder highlight on conversation DND recent
    merge

 src/client/folder-list/folder-list-tree.vala | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/client/folder-list/folder-list-tree.vala b/src/client/folder-list/folder-list-tree.vala
index e9163da1..269ee831 100644
--- a/src/client/folder-list/folder-list-tree.vala
+++ b/src/client/folder-list/folder-list-tree.vala
@@ -25,7 +25,7 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
     private Application.NotificationContext? monitor = null;
 
     public Tree() {
-        base(TARGET_ENTRY_LIST, Gdk.DragAction.ASK, drop_handler);
+        base(TARGET_ENTRY_LIST, Gdk.DragAction.COPY | Gdk.DragAction.MOVE, drop_handler);
         base_ref();
         entry_selected.connect(on_entry_selected);
 
@@ -209,6 +209,22 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
         folder_selected(null);
     }
 
+    public override bool drag_motion(Gdk.DragContext context, int x, int y, uint time) {
+        // Run the base version first.
+        bool ret = base.drag_motion(context, x, y, time);
+
+        // Update the cursor for copy or move.
+        Gdk.ModifierType mask;
+        double[] axes = new double[2];
+        context.get_device().get_state(context.get_dest_window(), axes, out mask);
+        if ((mask & Gdk.ModifierType.CONTROL_MASK) != 0) {
+            Gdk.drag_status(context, Gdk.DragAction.COPY, time);
+        } else {
+            Gdk.drag_status(context, Gdk.DragAction.MOVE, time);
+        }
+        return ret;
+    }
+
     private void on_ordinal_changed() {
         if (account_branches.size <= 1)
             return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]