GNOME Bugzilla – Bug 459022
DnD on a TextView which is not editable
Last modified: 2007-10-18 04:01:50 UTC
It seems that there is no easy way to make DnD of files work on a TextView which is not editable. I can understand the intention to not enable this in GTK because a DnD is supposed to "change" something. I thought about possible workarounds like catching the DnD with an EventBox or enabling the TextView on drag_motion and disable it on drag_leave. (I could not make it work with the EventBox) Nevertheless, why not let a TextView behave the same, whether it is editable or not?
Created attachment 92127 [details] DnD testcase on a TextView, written in pygtk Please try and drop a file on the TextView, with and without line 11 commented.
Created attachment 97399 [details] Working custom textview dnd I don't think it's legitimate to override just part of the TextView dnd like that. You are piggybacking off of part of the handling that is meant to insert text, so naturally the feedback and whether it accepts the drops is going to depend on whether it is editable or not. Here's a more complete (if not fully debugged) example of how you might override handling of DND in GtkTextView, taking file drops when not editable.