From fe245c3ae28bd9638bcbbb0f1982a356635e8f2c Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 25 Jul 2014 16:47:04 +0200 Subject: Ignore drag&drop requests from a window onto itself Avoids accidential DnD of an image into the same window (e.g. while trying to scroll) and the resulting reload. Eog bug http://bugzilla.gnome.org/show_bug.cgi?id=585069 Based on eog commit 6a406bf93969a73159b67eefe125f700a1f82126 From Felix Riemann --- src/eom-window.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/eom-window.c') diff --git a/src/eom-window.c b/src/eom-window.c index 0d9f636..2cb28e7 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -4189,12 +4189,25 @@ eom_window_drag_data_received (GtkWidget *widget, GSList *file_list; EomWindow *window; GdkAtom target; + GtkWidget *src; target = gtk_selection_data_get_target (selection_data); if (!gtk_targets_include_uri (&target, 1)) return; + /* if the request is from another process this will return NULL */ + src = gtk_drag_get_source_widget (context); + + /* if the drag request originates from the current eog instance, ignore + the request if the source window is the same as the dest window */ + if (src && + gtk_widget_get_toplevel (src) == gtk_widget_get_toplevel (widget)) + { + gdk_drag_status (context, 0, time); + return; + } + if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_COPY) { window = EOM_WINDOW (widget); -- cgit v1.2.1