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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 13 09:26:19 UTC 2020


 vcl/unx/gtk3/gtk3gtkinst.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 97b7b6030a6cf5b28ae0c1f61f7f55167b82dab6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Oct 12 20:21:37 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Oct 13 11:25:40 2020 +0200

    with a DND_ACTION_NONE drag action and zero target-formats disable drag
    
    so we can support dynamically disable/enable dnd
    
    Change-Id: Icfec79c332ef073e04be5a57747e849b27098732
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104221
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index de24e8c98a75..1c67472bf8c8 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2354,7 +2354,10 @@ private:
 
     virtual void drag_source_set(const std::vector<GtkTargetEntry>& rGtkTargets, GdkDragAction eDragAction)
     {
-        gtk_drag_source_set(m_pWidget, GDK_BUTTON1_MASK, rGtkTargets.data(), rGtkTargets.size(), eDragAction);
+        if (rGtkTargets.empty() && !eDragAction)
+            gtk_drag_source_unset(m_pWidget);
+        else
+            gtk_drag_source_set(m_pWidget, GDK_BUTTON1_MASK, rGtkTargets.data(), rGtkTargets.size(), eDragAction);
     }
 
     void do_set_background(const Color& rColor)
@@ -11480,7 +11483,10 @@ public:
 
     virtual void drag_source_set(const std::vector<GtkTargetEntry>& rGtkTargets, GdkDragAction eDragAction) override
     {
-        gtk_tree_view_enable_model_drag_source(m_pTreeView, GDK_BUTTON1_MASK, rGtkTargets.data(), rGtkTargets.size(), eDragAction);
+        if (rGtkTargets.empty() && !eDragAction)
+            gtk_tree_view_unset_rows_drag_source(m_pTreeView);
+        else
+            gtk_tree_view_enable_model_drag_source(m_pTreeView, GDK_BUTTON1_MASK, rGtkTargets.data(), rGtkTargets.size(), eDragAction);
     }
 
     virtual void set_selection_mode(SelectionMode eMode) override


More information about the Libreoffice-commits mailing list