vcl/unx/gtk3/gtk3gtkinst.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 881d176ec8baa2f00aa78236912db5fe346445f7
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Nov 4 11:28:51 2019 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed Nov 13 06:52:43 2019 +0100

    improve pivot table dnd highlighting
    
    if we're dropping into a treeview that is in list mode then use
    GTK_TREE_VIEW_DROP_AFTER instead when GTK_TREE_VIEW_DROP_INTO_OR_AFTER is
    suggested.
    
    Change-Id: I446e70a1e10a2e6e50bd7a098c54a91bcfa6abb9
    
    improve pivot table dnd highlighting
    
    unhighlight row when widget is unhighlighted and only
    highlight a row if the widget is highlighted
    
    Change-Id: I415207b4b263c5125f52abd57efe3543e2411b36
    Reviewed-on: https://gerrit.libreoffice.org/82001
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 4162fc263a62..572dee1f08b9 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6469,6 +6469,7 @@ private:
     std::vector<int> m_aViewColToModelCol;
     std::vector<int> m_aModelColToViewCol;
     bool m_bWorkAroundBadDragRegion;
+    bool m_bInDrag;
     gint m_nTextCol;
     gint m_nImageCol;
     gint m_nExpanderImageCol;
@@ -6855,6 +6856,7 @@ public:
         , m_pTreeView(pTreeView)
         , m_pTreeStore(GTK_TREE_STORE(gtk_tree_view_get_model(m_pTreeView)))
         , m_bWorkAroundBadDragRegion(false)
+        , m_bInDrag(false)
         , m_nTextCol(-1)
         , m_nImageCol(-1)
         , m_nExpanderImageCol(-1)
@@ -8114,7 +8116,7 @@ public:
                 gtkpos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
             {
                 ret = false;
-                pos = gtkpos;
+                pos = bAsTree ? gtkpos : GTK_TREE_VIEW_DROP_AFTER;
             }
         }
 
@@ -8124,8 +8126,11 @@ public:
             gtk_tree_model_get_iter(pModel, &rGtkIter.iter, path);
         }
 
-        // highlight the row
-        gtk_tree_view_set_drag_dest_row(m_pTreeView, path, pos);
+        if (m_bInDrag)
+        {
+            // highlight the row
+            gtk_tree_view_set_drag_dest_row(m_pTreeView, path, pos);
+        }
 
         assert(path);
         gtk_tree_path_free(path);
@@ -8170,6 +8175,7 @@ public:
     // of the treeview's highlight effort
     virtual void drag_started() override
     {
+        m_bInDrag = true;
         GtkWidget* pWidget = GTK_WIDGET(m_pTreeView);
         GtkWidget* pParent = gtk_widget_get_parent(pWidget);
         if (GTK_IS_SCROLLED_WINDOW(pParent))
@@ -8182,6 +8188,7 @@ public:
 
     virtual void drag_ended() override
     {
+        m_bInDrag = false;
         if (m_bWorkAroundBadDragRegion)
         {
             GtkWidget* pWidget = GTK_WIDGET(m_pTreeView);
@@ -8189,6 +8196,8 @@ public:
             gtk_drag_unhighlight(pParent);
             m_bWorkAroundBadDragRegion = false;
         }
+        // unhighlight the row
+        gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, 
GTK_TREE_VIEW_DROP_BEFORE);
     }
 
     virtual ~GtkInstanceTreeView() override
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to