@@ -386,12 +386,18 @@ type cDollarGestureEvent C.SDL_DollarGestureEvent
386
386
// DropEvent contains an event used to request a file open by the system.
387
387
// (https://wiki.libsdl.org/SDL_DropEvent)
388
388
type DropEvent struct {
389
- Type uint32 // DROPFILE, DROPTEXT, DROPBEGIN, DROPCOMPLETE
390
- Timestamp uint32 // timestamp of the event
391
- File unsafe.Pointer // the file name
392
- WindowID uint32 // the window that was dropped on, if any
389
+ Type uint32 // DROPFILE, DROPTEXT, DROPBEGIN, DROPCOMPLETE
390
+ Timestamp uint32 // timestamp of the event
391
+ File string // the file name
392
+ WindowID uint32 // the window that was dropped on, if any
393
+ }
394
+
395
+ type cDropEvent struct {
396
+ Type uint32
397
+ Timestamp uint32
398
+ File unsafe.Pointer
399
+ WindowID uint32
393
400
}
394
- type cDropEvent C.SDL_DropEvent
395
401
396
402
// RenderEvent contains render event information.
397
403
// (https://wiki.libsdl.org/SDL_EventType)
@@ -576,7 +582,10 @@ func goEvent(cevent *CEvent) Event {
576
582
case MULTIGESTURE :
577
583
return (* MultiGestureEvent )(unsafe .Pointer (cevent ))
578
584
case DROPFILE :
579
- return (* DropEvent )(unsafe .Pointer (cevent ))
585
+ e := (* cDropEvent )(unsafe .Pointer (cevent ))
586
+ event := DropEvent {Type : e .Type , Timestamp : e .Timestamp , File : string (C .GoString ((* C .char )(e .File ))), WindowID : e .WindowID }
587
+ C .SDL_free (e .File )
588
+ return & event
580
589
case RENDER_TARGETS_RESET :
581
590
return (* RenderEvent )(unsafe .Pointer (cevent ))
582
591
case QUIT :
0 commit comments