Thread from comp.lang.tcl (no replies yet)
File drags from tcl/tkdnd apps into a GTK3 app are ignored
File drags from my tcl/tkdnd app into a GTK3 app are ignored. The issue appears to be that the drop data is interpreted as a string rather than a list of file URIs, e.g. dropData.get_data() returns the dropped file name but dropData.get_uris() returns an empty list, as demonstrated by the following demo code. I also noticed that the drop target cursor changes to a hand when dropping a file from Nautilus File (Gtk based) tool but it does not change when dropping from the tcl/tk app. Any pointers on how to get the tck/tk client to work with Gtk3 are much appreciated. Alternatively, is there a tool that I can use to view the WM messages that are sent during the drag/drop in order to debug the issue? I am running Gnome 42.9 on Ubuntu 22.04. Tcl/tkdnd drop file source app: package require tkdnd catch {console show} pack [ttk::button .drag_source_files -text " Drag File "] -fill x -padx 20 -pady 20 tkdnd::drag_source register .drag_source_files DND_Files bind .drag_source_files <<DragInitCmd>> \ {list {copy} DND_Files [list "file:///tmp/test.wav" ]} ## Event <<DragEndCmd>> bind .drag_source_files <<DragEndCmd>> { puts "Drop action: %A" } Gtk drop receiver app: import gi gi.require_version("Gdk", "3.0") gi.require_version("Gtk", "3.0") from gi.repository import Gtk, Gdk window = Gtk.Window() window.connect("delete-event", Gtk.main_quit) box = Gtk.HBox() window.add(box) # Called when the Drop button is dropped on def on_drag_data_received(widget, drag_context, x, y, data, info, time): print("Received uris: {}".format(data.get_uris())) # returns empty list print("Received data: {}".format(data.get_data())) # returns file name # The button into which the file can be dropped drop_button = Gtk.Button(label="Drop") drop_button.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY) drop_button.drag_dest_add_uri_targets() # This makes sure that the buttons are using URIs, not text drop_button.connect("drag-data-received", on_drag_data_received) box.add(drop_button) window.show_all() Gtk.main()Click on article to view all threads in comp.lang.tcl