diff -up evolution-3.22.6/composer/e-msg-composer.c.composer-dnd evolution-3.22.6/composer/e-msg-composer.c
--- evolution-3.22.6/composer/e-msg-composer.c.composer-dnd 2017-04-13 14:06:08.863067766 +0200
+++ evolution-3.22.6/composer/e-msg-composer.c 2017-04-13 14:06:08.878067765 +0200
@@ -1867,6 +1867,16 @@ msg_composer_drag_drop_cb (GtkWidget *wi
}
static void
+msg_composer_drop_handled_cb (EContentEditor *cnt_editor,
+ EMsgComposer *composer)
+{
+ if (composer->priv->drag_data_received_handler_id != 0) {
+ g_signal_handler_disconnect (cnt_editor, composer->priv->drag_data_received_handler_id);
+ composer->priv->drag_data_received_handler_id = 0;
+ }
+}
+
+static void
msg_composer_drag_begin_cb (GtkWidget *widget,
GdkDragContext *context,
EMsgComposer *composer)
@@ -2272,6 +2282,10 @@ msg_composer_constructed (GObject *objec
G_CALLBACK (msg_composer_drag_begin_cb), composer);
g_signal_connect (
+ cnt_editor, "drop-handled",
+ G_CALLBACK (msg_composer_drop_handled_cb), composer);
+
+ g_signal_connect (
composer->priv->gallery_icon_view, "drag-data-get",
G_CALLBACK (msg_composer_gallery_drag_data_get), NULL);
diff -up evolution-3.22.6/e-util/e-content-editor.c.composer-dnd evolution-3.22.6/e-util/e-content-editor.c
--- evolution-3.22.6/e-util/e-content-editor.c.composer-dnd 2016-11-30 20:06:07.000000000 +0100
+++ evolution-3.22.6/e-util/e-content-editor.c 2017-04-13 14:06:08.878067765 +0200
@@ -36,6 +36,7 @@ enum {
CONTEXT_MENU_REQUESTED,
FIND_DONE,
REPLACE_ALL_DONE,
+ DROP_HANDLED,
LAST_SIGNAL
};
@@ -509,6 +510,20 @@ e_content_editor_default_init (EContentE
NULL,
G_TYPE_NONE, 1,
G_TYPE_UINT);
+
+ /**
+ * EContentEditor:drop-handled
+ *
+ * Emitted when the content editor successfully handled the drop operation.
+ */
+ signals[DROP_HANDLED] = g_signal_new (
+ "drop-handled",
+ E_TYPE_CONTENT_EDITOR,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EContentEditorInterface, drop_handled),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
}
ESpellChecker *
@@ -3581,3 +3596,11 @@ e_content_editor_emit_replace_all_done (
g_signal_emit (editor, signals[REPLACE_ALL_DONE], 0, replaced_count);
}
+
+void
+e_content_editor_emit_drop_handled (EContentEditor *editor)
+{
+ g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
+
+ g_signal_emit (editor, signals[DROP_HANDLED], 0);
+}
diff -up evolution-3.22.6/e-util/e-content-editor.h.composer-dnd evolution-3.22.6/e-util/e-content-editor.h
--- evolution-3.22.6/e-util/e-content-editor.h.composer-dnd 2016-09-19 10:22:58.000000000 +0200
+++ evolution-3.22.6/e-util/e-content-editor.h 2017-04-13 14:06:08.878067765 +0200
@@ -437,6 +437,7 @@ struct _EContentEditorInterface {
guint match_count);
void (*replace_all_done) (EContentEditor *editor,
guint replaced_count);
+ void (*drop_handled) (EContentEditor *editor);
};
/* Properties */
@@ -1015,6 +1016,8 @@ void e_content_editor_emit_find_done (E
void e_content_editor_emit_replace_all_done
(EContentEditor *editor,
guint replaced_count);
+void e_content_editor_emit_drop_handled
+ (EContentEditor *editor);
G_END_DECLS
diff -up evolution-3.22.6/modules/webkit-editor/e-webkit-editor.c.composer-dnd evolution-3.22.6/modules/webkit-editor/e-webkit-editor.c
--- evolution-3.22.6/modules/webkit-editor/e-webkit-editor.c.composer-dnd 2017-04-13 14:06:08.875067765 +0200
+++ evolution-3.22.6/modules/webkit-editor/e-webkit-editor.c 2017-04-13 14:06:28.256067497 +0200
@@ -5913,10 +5913,16 @@ webkit_editor_drag_data_received_cb (Gtk
info == E_DND_TARGET_TYPE_UTF8_STRING || info == E_DND_TARGET_TYPE_STRING ||
info == E_DND_TARGET_TYPE_TEXT_PLAIN || info == E_DND_TARGET_TYPE_TEXT_PLAIN_UTF8) {
gdk_drag_status (context, gdk_drag_context_get_selected_action(context), time);
- GTK_WIDGET_CLASS (e_webkit_editor_parent_class)->drag_drop (widget, context, x, y, time);
- g_signal_stop_emission_by_name (widget, "drag-data-received");
- if (!is_move)
- webkit_editor_call_simple_extension_function (wk_editor, "DOMLastDropOperationDidCopy");
+ if (!GTK_WIDGET_CLASS (e_webkit_editor_parent_class)->drag_drop (widget, context, x, y, time)) {
+ g_warning ("Drop failed in WebKit");
+ goto process_ourselves;
+ } else {
+ GTK_WIDGET_CLASS (e_webkit_editor_parent_class)->drag_leave(widget, context, time);
+ g_signal_stop_emission_by_name (widget, "drag-data-received");
+ if (!is_move)
+ webkit_editor_call_simple_extension_function (wk_editor, "DOMLastDropOperationDidCopy");
+ e_content_editor_emit_drop_handled (E_CONTENT_EDITOR (widget));
+ }
return;
}
@@ -5926,6 +5932,7 @@ webkit_editor_drag_data_received_cb (Gtk
gint list_len, len;
gchar *text;
+ process_ourselves:
data = gtk_selection_data_get_data (selection);
length = gtk_selection_data_get_length (selection);
@@ -5949,10 +5956,21 @@ webkit_editor_drag_data_received_cb (Gtk
gtk_drag_finish (context, TRUE, is_move, time);
g_signal_stop_emission_by_name (widget, "drag-data-received");
+ e_content_editor_emit_drop_handled (E_CONTENT_EDITOR (widget));
return;
}
}
+static void
+webkit_editor_drag_leave_cb (EWebKitEditor *wk_editor,
+ GdkDragContext *context,
+ guint time)
+{
+ /* Don't pass drag-leave to WebKit otherwise the drop won't be handled by it.
+ * We will emit it later when WebKit is expecting it. */
+ g_signal_stop_emission_by_name (GTK_WIDGET (wk_editor), "drag-leave");
+}
+
static gboolean
webkit_editor_drag_drop_cb (EWebKitEditor *wk_editor,
GdkDragContext *context,
@@ -6255,6 +6273,10 @@ e_webkit_editor_init (EWebKitEditor *wk_
G_CALLBACK (webkit_editor_drag_end_cb), NULL);
g_signal_connect (
+ wk_editor, "drag-leave",
+ G_CALLBACK (webkit_editor_drag_leave_cb), NULL);
+
+ g_signal_connect (
wk_editor, "drag-drop",
G_CALLBACK (webkit_editor_drag_drop_cb), NULL);