forked from Leak_Technologies/VideoTools
Fix drag target setup for gtkplayer
This commit is contained in:
parent
aba4d14f57
commit
bec66816df
|
|
@ -267,21 +267,16 @@ func preferDark() {
|
|||
|
||||
func setupDragDest(p *pane, win *gtk.Window) {
|
||||
// Accept URI drops
|
||||
targets := []gtk.TargetEntry{
|
||||
{Target: "text/uri-list", Flags: uint(0), Info: uint(0)},
|
||||
}
|
||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, targets, gdk.ACTION_COPY)
|
||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{gtk.TargetEntry{}} /* dummy */, 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 {
|
||||
ctx.Finish(false, false, t)
|
||||
return
|
||||
}
|
||||
// Take first URI
|
||||
if path := uriToPath(uris[0]); path != "" {
|
||||
loadIntoPane(p, path)
|
||||
}
|
||||
ctx.Finish(true, false, t)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user