[Libreoffice-commits] core.git: include/vcl sc/source vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 6 14:43:26 UTC 2020


 include/vcl/treelistbox.hxx                    |    2 ++
 include/vcl/weld.hxx                           |    1 +
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx |    1 +
 vcl/source/app/salvtables.cxx                  |    5 +++++
 vcl/source/treelist/treelistbox.cxx            |   12 ++++++++++--
 vcl/unx/gtk3/gtk3gtkinst.cxx                   |    5 +++++
 6 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 251fbdc642b9c27e9ad467322fb6d4e5c8f76a4c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Apr 6 14:19:32 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Apr 6 16:42:47 2020 +0200

    unset dest dnd row highlight after drop
    
    Change-Id: Id9b70b247351a5c12b6540c828e2c34f9fb31c11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91750
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index e56fd1081fb2..cce02a9286b6 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -278,6 +278,8 @@ private:
     VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, const SvTreeListEntry& rEntry);
     VCL_DLLPRIVATE Size MeasureCustomEntry(vcl::RenderContext& rRenderContext, const SvTreeListEntry& rEntry);
 
+    void UnsetDropTarget();
+
 protected:
 
     bool            CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e8536e4a5660..3f3689fccc61 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1096,6 +1096,7 @@ public:
 
     // for dnd
     virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) = 0;
+    virtual void unset_drag_dest_row() = 0;
     virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
     // for dragging and dropping between TreeViews, return the active source
     virtual TreeView* get_drag_source() const = 0;
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 2ae02800c032..c80b64b4a5c6 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -58,6 +58,7 @@ sal_Int8 ScPivotLayoutTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt
     if (rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
         nTargetPos = rWidget.get_iter_index_in_parent(*xTarget);
     m_rTreeView.InsertEntryForSourceTarget(*pSource, nTargetPos);
+    rWidget.unset_drag_dest_row();
     return DND_ACTION_NONE;
 }
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 1ae61d3ee21a..14dab888e080 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4564,6 +4564,11 @@ public:
         return pTarget != nullptr;
     }
 
+    virtual void unset_drag_dest_row() override
+    {
+        m_xTreeView->UnsetDropTarget();
+    }
+
     virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override
     {
         return m_xTreeView->GetBoundingRect(static_cast<const SalInstanceTreeIter&>(rIter).iter);
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index f54e184356d4..274b61b906b5 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1225,13 +1225,21 @@ nAction
     }
 #endif
 
-    ImplShowTargetEmphasis( pTargetEntry, false );
+    UnsetDropTarget();
     g_pDDSource = nullptr;
     g_pDDTarget = nullptr;
-    pTargetEntry = nullptr;
     nDragDropMode = nOldDragMode;
 }
 
+void SvTreeListBox::UnsetDropTarget()
+{
+    if (pTargetEntry)
+    {
+        ImplShowTargetEmphasis(pTargetEntry, false);
+        pTargetEntry = nullptr;
+    }
+}
+
 DragDropMode SvTreeListBox::NotifyStartDrag( TransferDataContainer&, SvTreeListEntry* )
 {
     return DragDropMode(0xffff);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 63f5e710f817..8b644d22d1c5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10970,6 +10970,11 @@ public:
         return ret;
     }
 
+    virtual void unset_drag_dest_row() override
+    {
+        gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, GTK_TREE_VIEW_DROP_BEFORE);
+    }
+
     virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override
     {
         tools::Rectangle aRet;


More information about the Libreoffice-commits mailing list