[evolution/gnome-3-36] I#969 - Workaround freeze on drag of message over composer body



commit 2895f8f2bc242d0e1c692030817c374740cefd75
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jun 5 13:40:41 2020 +0200

    I#969 - Workaround freeze on drag of message over composer body
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/969

 src/modules/webkit-editor/e-webkit-editor.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 9c925dd1f8..7b56d080e3 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -6210,6 +6210,28 @@ webkit_editor_drag_leave_cb (EWebKitEditor *wk_editor,
        g_signal_stop_emission_by_name (GTK_WIDGET (wk_editor), "drag-leave");
 }
 
+static gboolean
+webkit_editor_drag_motion_cb (GtkWidget *widget,
+                             GdkDragContext *context,
+                             gint x,
+                             gint y,
+                             guint time,
+                             gpointer user_data)
+{
+       GdkAtom chosen;
+
+       chosen = gtk_drag_dest_find_target (widget, context, NULL);
+
+       /* This is when dragging message from the message list, which can eventually freeze
+          Evolution, if PDF file format is set, when processes by WebKitGTK itself. */
+       if (chosen != GDK_NONE && chosen == gdk_atom_intern ("x-uid-list", TRUE)) {
+               gdk_drag_status (context, GDK_ACTION_COPY, time);
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
 static gboolean
 webkit_editor_drag_drop_cb (EWebKitEditor *wk_editor,
                             GdkDragContext *context,
@@ -6585,6 +6607,10 @@ e_webkit_editor_init (EWebKitEditor *wk_editor)
                wk_editor, "drag-drop",
                G_CALLBACK (webkit_editor_drag_drop_cb), NULL);
 
+       g_signal_connect (
+               wk_editor, "drag-motion",
+               G_CALLBACK (webkit_editor_drag_motion_cb), NULL);
+
        g_signal_connect (
                wk_editor, "web-process-crashed",
                G_CALLBACK (webkit_editor_web_process_crashed_cb), NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]