[eog] Ignore drag&drop requests from a window onto itself



commit 6a406bf93969a73159b67eefe125f700a1f82126
Author: Felix Riemann <friemann gnome org>
Date:   Mon Dec 6 21:55:25 2010 +0100

    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. Fixes bug 585069.

 src/eog-window.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index d144605..befe84e 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -3955,12 +3955,25 @@ eog_window_drag_data_received (GtkWidget *widget,
         GSList *file_list;
         EogWindow *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 = EOG_WINDOW (widget);



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