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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat May 2 18:17:52 UTC 2020


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

New commits:
commit ce019a60c0a348eb08453dc159e2805ffe2ba188
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat May 2 17:16:13 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat May 2 20:17:10 2020 +0200

    Related: tdf#132477 use GDK_KEY_Escape to cancel dnd
    
    simply calling gtk_drag_cancel on the treeview dnd under X doesn't seem to work
    as hoped for (though under wayland all is well).  Under X the next (allowed)
    drag effort doesn't work to drop anything, but a then repeated attempt does.
    
    But sending an Escape keyevent to get gtk to cancel the drag for us does work
    as hoped for.
    
    Change-Id: I09d3187e66774f9d23c77e0d515af7ae2a8fe156
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93317
    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 7732afb6821f..20bf6596cd77 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3070,6 +3070,18 @@ IMPL_LINK(GtkInstanceWidget, async_drag_cancel, void*, arg, void)
 {
     m_pDragCancelEvent = nullptr;
     GdkDragContext* context = static_cast<GdkDragContext*>(arg);
+
+    // tdf#132477 simply calling gtk_drag_cancel on the treeview dnd under X
+    // doesn't seem to work as hoped for (though under wayland all is well).
+    // Under X the next (allowed) drag effort doesn't work to drop anything,
+    // but a then repeated attempt does.
+    // Sending ESC to get gtk to cancel the drag for us does work as hoped for.
+    GdkEvent *event = GtkSalFrame::makeFakeKeyPress(m_pWidget);
+    event->key.keyval = GDK_KEY_Escape;
+    gtk_main_do_event(event);
+    gdk_event_free(event);
+
+    // Retain this gtk_drag_cancel belt-and-braces call anyway
     gtk_drag_cancel(context);
     g_object_unref(context);
 }


More information about the Libreoffice-commits mailing list