Some docs

This commit is contained in:
Vlad K 2017-06-19 00:19:11 +03:00
parent 527efca095
commit aba85d479c
3 changed files with 11 additions and 7 deletions

View file

@ -693,9 +693,8 @@ namespace OpenTK.Platform.Windows
IntPtr str = Marshal.AllocHGlobal((int)fileNameSize);
Functions.DragQueryFile(hDrop, i, str, fileNameSize);
Marshal.Copy(str, byteArray, 0, (int)(fileNameSize - 1));
string dropString = System.Text.Encoding.UTF8.GetString(byteArray);
string dropString = Marshal.PtrToStringAuto(str);
OnFileDrop(dropString);
Marshal.FreeHGlobal(str);

View file

@ -53,10 +53,13 @@ namespace OpenTK.Platform.X11
#endregion
// X11 has some defined values
// Whis values are defined with c's #define in X.h
internal static class Consts
{
public static readonly IntPtr None = IntPtr.Zero;
public static readonly IntPtr CurrentTime = IntPtr.Zero;
// Universal null resource or null atom
public static readonly IntPtr None = IntPtr.Zero; // #define None 0L
// Special time value
public static readonly IntPtr CurrentTime = IntPtr.Zero; // #define CurrentTime 0L
}
#region internal static class API

View file

@ -861,7 +861,6 @@ namespace OpenTK.Platform.X11
// Process all pending events
while (Exists && window != null)
{
//Functions.XNextEvent(window.Display, ref e);
using (new XLock(window.Display))
{
if (!Functions.XCheckWindowEvent(window.Display, window.Handle, window.EventMask, ref e) &&
@ -910,9 +909,13 @@ namespace OpenTK.Platform.X11
break;
}
}
// For X11 drag and drop handling use https://freedesktop.org/wiki/Specifications/XDND/#index9h2
else if (e.ClientMessageEvent.message_type == _atom_xdnd_enter)
{
// Xdnd started
// ptr1 -> source window handler
// ptr2 bit 0 -> set to 1 if source support more than three data formats
// ptr2 third byte contains Xdnd version that source supports
bool useList = ((e.ClientMessageEvent.ptr2.ToInt64() & 1) == 1);
sourceHandler = e.ClientMessageEvent.ptr1;
sourceXdndVersion = e.ClientMessageEvent.ptr2.ToInt64() >> 24;
@ -927,7 +930,6 @@ namespace OpenTK.Platform.X11
}
else
{
// Bad code it will save only 1 format
formats = Marshal.AllocHGlobal(3 * IntPtr.Size);
Marshal.WriteIntPtr(formats, e.ClientMessageEvent.ptr3);
Marshal.WriteIntPtr(formats, IntPtr.Size * 2, e.ClientMessageEvent.ptr4);