forked from Leak_Technologies/VideoTools
Fix drag target setup crash (require non-empty target list)
This commit is contained in:
parent
6fc4d80e6c
commit
fdb0f44fa7
|
|
@ -268,12 +268,12 @@ func preferDark() {
|
|||
|
||||
func setupDragDest(p *pane, win *gtk.Window) {
|
||||
// Accept URI drops using a target list
|
||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, nil, gdk.ACTION_COPY)
|
||||
// gotk3 doesn't expose TargetList easily on drawing area; set default URI target via TargetEntry
|
||||
target, err := gtk.TargetEntryNew("text/uri-list", gtk.TARGET_OTHER_APP, 0)
|
||||
if err == nil {
|
||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{*target}, gdk.ACTION_COPY)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// DragDestSet requires at least one target; use the URI target.
|
||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{*target}, gdk.ACTION_COPY)
|
||||
p.area.Connect("drag-data-received", func(_ *gtk.DrawingArea, ctx *gdk.DragContext, x, y int, data *gtk.SelectionData, info uint, t uint32) {
|
||||
uris := data.GetURIs()
|
||||
if len(uris) == 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user