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) {
|
func setupDragDest(p *pane, win *gtk.Window) {
|
||||||
// Accept URI drops
|
// Accept URI drops
|
||||||
targets := []gtk.TargetEntry{
|
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{gtk.TargetEntry{}} /* dummy */, gdk.ACTION_COPY)
|
||||||
{Target: "text/uri-list", Flags: uint(0), Info: uint(0)},
|
|
||||||
}
|
|
||||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, targets, 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) {
|
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()
|
uris := data.GetURIs()
|
||||||
if len(uris) == 0 {
|
if len(uris) == 0 {
|
||||||
ctx.Finish(false, false, t)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Take first URI
|
// Take first URI
|
||||||
if path := uriToPath(uris[0]); path != "" {
|
if path := uriToPath(uris[0]); path != "" {
|
||||||
loadIntoPane(p, path)
|
loadIntoPane(p, path)
|
||||||
}
|
}
|
||||||
ctx.Finish(true, false, t)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user