mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-04-17 23:51:44 +00:00
SDL2 rewrite c string to c# shtring + some docs
This commit is contained in:
parent
1a20ca5245
commit
527efca095
|
@ -2,6 +2,10 @@
|
|||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
{
|
||||
// Values for enum : https://developer.apple.com/documentation/appkit/nsdragoperation?language=objc
|
||||
// or for Mac users /System/Library/Frameworks/AppKit.framework/Headers
|
||||
// Used by draggingSourceOperationMask(:) to get permission for dropped object
|
||||
// also used for respones to drag source
|
||||
enum NSDragOperation : int
|
||||
{
|
||||
None = 0,
|
||||
|
@ -14,4 +18,4 @@ namespace OpenTK.Platform.MacOS
|
|||
Delete = 32,
|
||||
Every = Int32.MaxValue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1461,8 +1461,6 @@ namespace OpenTK.Platform.SDL2
|
|||
public MultiGestureEvent mgesture;
|
||||
[FieldOffset(0)]
|
||||
public DollarGestureEvent dgesture;
|
||||
[FieldOffset(0)]
|
||||
public DropEvent drop;
|
||||
#endif
|
||||
|
||||
// Ensure the structure is big enough
|
||||
|
@ -1761,6 +1759,7 @@ namespace OpenTK.Platform.SDL2
|
|||
public Int32 Data2;
|
||||
}
|
||||
|
||||
// For detailed info look: https://wiki.libsdl.org/SDL_DropEvent
|
||||
struct DropEvent
|
||||
{
|
||||
public UInt32 Type;
|
||||
|
|
|
@ -304,15 +304,7 @@ namespace OpenTK.Platform.SDL2
|
|||
|
||||
static unsafe void ProcessDropEvent(Sdl2NativeWindow window, DropEvent ev)
|
||||
{
|
||||
byte* str = (byte*)ev.File;
|
||||
|
||||
int length = 0;
|
||||
for (; str[length] != 0; length++)
|
||||
;
|
||||
|
||||
byte [] byteArray = new byte[length];
|
||||
Marshal.Copy(ev.File, byteArray, 0, length);
|
||||
string dropString = System.Text.Encoding.UTF8.GetString(byteArray);
|
||||
string dropString = Marshal.PtrToStringAuto(ev.File);
|
||||
window.OnFileDrop(dropString);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,8 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
#region Window functions
|
||||
|
||||
#region Drag functions
|
||||
|
||||
[DllImport("shell32.dll")]
|
||||
internal static extern bool DragAcceptFiles(
|
||||
IntPtr handle,
|
||||
|
@ -155,6 +157,8 @@ namespace OpenTK.Platform.Windows
|
|||
HDROP hDrop
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetWindowPos
|
||||
|
||||
// WINUSERAPI BOOL WINAPI SetWindowPos(__in HWND hWnd, __in_opt HWND hWndInsertAfter,
|
||||
|
|
Loading…
Reference in a new issue