Allow DropEvent users to access UTF8_ToManaged

This commit is contained in:
Ethan Lee 2018-11-27 09:53:36 -05:00
parent 0cd8f85918
commit 65d719a058

View file

@ -54,7 +54,8 @@ namespace SDL2
return System.Text.Encoding.UTF8.GetBytes(s + '\0');
}
internal static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
/* This is public because SDL_DropEvent needs it! */
public static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
{
if (s == IntPtr.Zero)
{
@ -3967,7 +3968,12 @@ namespace SDL2
{
public SDL_EventType type;
public UInt32 timestamp;
public IntPtr file; /* char* filename, to be freed */
/* char* filename, to be freed.
* Access the variable EXACTLY ONCE like this:
* string s = SDL.UTF8_ToManaged(evt.drop.file, true);
*/
public IntPtr file;
}
[StructLayout(LayoutKind.Sequential)]