diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-04 11:36:09 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-04 16:44:13 +0100 |
commit | f7f47654787c8fd1764a8d827bb6a84b17fe3882 (patch) | |
tree | bbd0d813c5574a6ac88c4a89c79ef8f7b6a82833 | |
parent | fe2c63e494ea66042406ad71234ebe076dec07dc (diff) |
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/81999
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 54cd3bee15c3..584ffe3266c0 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -7838,6 +7838,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; @@ -8294,6 +8295,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) @@ -9605,8 +9607,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); @@ -9695,6 +9700,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)) @@ -9707,6 +9713,7 @@ public: virtual void drag_ended() override { + m_bInDrag = false; if (m_bWorkAroundBadDragRegion) { GtkWidget* pWidget = GTK_WIDGET(m_pTreeView); @@ -9714,6 +9721,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 |