hellosiyan / Viewnior

Elegant Image Viewer
https://siyanpanayotov.com/project/viewnior/
GNU General Public License v3.0
320 stars 54 forks source link

Don't allow drag and drop if source is the viewer itself #69

Closed AXDOOMER closed 3 years ago

AXDOOMER commented 4 years ago

There's a bug with drag and drop where a user can drag an image from Viewnior and drop it in into the same instance of Viewnior.

This becomes a problem when the user selects a few images from a folder that contains many and opens them with Viewnior. When navigating through the images, the user will only see the ones he selected. This is alright, but if he accidentally tries to move the image while it's not zoomed in, this will trigger a drag and drop. This will change the number of images the user is browsing from his initial selection to all the images that are inside the folder where this image is.

This code change in this PR fixes this issue by not updating the list of images to browse if the drag and drop was triggered from inside the application.

gtk_drag_get_source_widget returns NULL if the source of the drag is not occurring within a single application. Viewnior can still be used to drag and drop images into GIMP after this change for example.

hellosiyan commented 3 years ago

Thanks, @AXDOOMER!