diff --git a/Source/OpenTK/Platform/INativeWindow.cs b/Source/OpenTK/Platform/INativeWindow.cs
index 491f9ea8..f219d288 100644
--- a/Source/OpenTK/Platform/INativeWindow.cs
+++ b/Source/OpenTK/Platform/INativeWindow.cs
@@ -10,8 +10,6 @@ namespace OpenTK.Platform
void ProcessEvents();
void Exit();
- event CreateEvent Create;
-
bool Created { get; }
bool Quit { get; }
IntPtr Handle { get; }
diff --git a/Source/OpenTK/Platform/Windows/API.cs b/Source/OpenTK/Platform/Windows/API.cs
index 380f3754..0d7312a0 100644
--- a/Source/OpenTK/Platform/Windows/API.cs
+++ b/Source/OpenTK/Platform/Windows/API.cs
@@ -57,11 +57,11 @@ namespace OpenTK.Platform.Windows
// Prevent BeforeFieldInit optimization, and initialize 'size' fields.
static API()
{
- RawInputHeaderSize = (uint)Marshal.SizeOf(typeof(RawInputHeader));
- RawInputSize = (uint)Marshal.SizeOf(typeof(RawInput));
- RawInputDeviceSize = (uint)Marshal.SizeOf(typeof(RawInputDevice));
- RawInputDeviceListSize = (uint)Marshal.SizeOf(typeof(RawInputDeviceList));
- RawInputDeviceInfoSize = (uint)Marshal.SizeOf(typeof(RawInputDeviceInfo));
+ RawInputHeaderSize = Marshal.SizeOf(typeof(RawInputHeader));
+ RawInputSize = Marshal.SizeOf(typeof(RawInput));
+ RawInputDeviceSize = Marshal.SizeOf(typeof(RawInputDevice));
+ RawInputDeviceListSize = Marshal.SizeOf(typeof(RawInputDeviceList));
+ RawInputDeviceInfoSize = Marshal.SizeOf(typeof(RawInputDeviceInfo));
}
#region Constants
@@ -246,6 +246,7 @@ namespace OpenTK.Platform.Windows
#region PostMessage
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("User32.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
@@ -256,6 +257,16 @@ namespace OpenTK.Platform.Windows
LPARAM lParam
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("User32.dll", CharSet = CharSet.Auto)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern BOOL PostMessage(
+ HWND hWnd,
+ INT Msg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
#endregion
#region PostQuitMessage
@@ -647,6 +658,7 @@ namespace OpenTK.Platform.Windows
#endregion
+ [CLSCompliant(false)]
[SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern LRESULT CallWindowProc(
@@ -657,6 +669,16 @@ namespace OpenTK.Platform.Windows
LPARAM lParam
);
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern LRESULT CallWindowProc(
+ WNDPROC lpPrevWndFunc,
+ HWND hWnd,
+ INT Msg,
+ WPARAM wParam,
+ LPARAM lParam
+ );
+
[SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern LONG_PTR SetWindowLongPtr(
@@ -719,6 +741,7 @@ namespace OpenTK.Platform.Windows
/// Number of RawInput structures pointed to by paRawInput.
/// Size, in bytes, of the RawInputHeader structure.
/// If successful, the function returns S_OK. Otherwise it returns an error value.
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern LRESULT DefRawInputProc(
@@ -727,6 +750,14 @@ namespace OpenTK.Platform.Windows
UINT SizeHeader
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern LRESULT DefRawInputProc(
+ RawInput[] RawInput,
+ INT Input,
+ INT SizeHeader
+ );
+
#endregion
#region RegisterRawInputDevices
@@ -746,6 +777,7 @@ namespace OpenTK.Platform.Windows
///
/// TRUE if the function succeeds; otherwise, FALSE. If the function fails, call GetLastError for more information.
///
+ [CLSCompliant(false)]
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern BOOL RegisterRawInputDevices(
@@ -754,6 +786,14 @@ namespace OpenTK.Platform.Windows
UINT Size
);
+ [DllImport("user32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern BOOL RegisterRawInputDevices(
+ RawInputDevice[] RawInputDevices,
+ INT NumDevices,
+ INT Size
+ );
+
#endregion
#region GetRawInputBuffer
@@ -773,6 +813,7 @@ namespace OpenTK.Platform.Windows
/// of RawInput structures written to Data.
/// If an error occurs, the return value is (UINT)-1. Call GetLastError for the error code.
///
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputBuffer(
@@ -781,6 +822,14 @@ namespace OpenTK.Platform.Windows
[In] UINT SizeHeader
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputBuffer(
+ [Out] RawInput[] Data,
+ [In, Out] ref INT Size,
+ [In] INT SizeHeader
+ );
+
#endregion
#region GetRegisteredRawInputDevices
@@ -811,6 +860,7 @@ namespace OpenTK.Platform.Windows
/// If the function fails for any other reason, it returns -1. For more details, call GetLastError.
///
///
+ [CLSCompliant(false)]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRegisteredRawInputDevices(
[Out] RawInput[] RawInputDevices,
@@ -818,6 +868,13 @@ namespace OpenTK.Platform.Windows
UINT cbSize
);
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRegisteredRawInputDevices(
+ [Out] RawInput[] RawInputDevices,
+ [In, Out] ref INT NumDevices,
+ INT cbSize
+ );
+
#endregion
#region GetRawInputDeviceList
@@ -849,6 +906,7 @@ namespace OpenTK.Platform.Windows
/// Calling GetLastError returns ERROR_INSUFFICIENT_BUFFER.
/// On any other error, the function returns (UINT) -1 and GetLastError returns the error indication.
///
+ [CLSCompliant(false)]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputDeviceList(
[In, Out] RawInputDeviceList[] RawInputDeviceList,
@@ -856,6 +914,13 @@ namespace OpenTK.Platform.Windows
UINT Size
);
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputDeviceList(
+ [In, Out] RawInputDeviceList[] RawInputDeviceList,
+ [In, Out] ref INT NumDevices,
+ INT Size
+ );
+
///
/// Enumerates the raw input devices attached to the system.
///
@@ -883,6 +948,7 @@ namespace OpenTK.Platform.Windows
/// Calling GetLastError returns ERROR_INSUFFICIENT_BUFFER.
/// On any other error, the function returns (UINT) -1 and GetLastError returns the error indication.
///
+ [CLSCompliant(false)]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputDeviceList(
[In, Out] IntPtr RawInputDeviceList,
@@ -890,6 +956,13 @@ namespace OpenTK.Platform.Windows
UINT Size
);
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputDeviceList(
+ [In, Out] IntPtr RawInputDeviceList,
+ [In, Out] ref INT NumDevices,
+ INT Size
+ );
+
#endregion
#region GetRawInputDeviceInfo
@@ -925,6 +998,7 @@ namespace OpenTK.Platform.Windows
/// If Data is not large enough for the data, the function returns -1. If Data is NULL, the function returns a value of zero. In both of these cases, Size is set to the minimum size required for the Data buffer.
/// Call GetLastError to identify any other errors.
///
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputDeviceInfo(
@@ -934,6 +1008,15 @@ namespace OpenTK.Platform.Windows
[In, Out] ref UINT Size
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputDeviceInfo(
+ HANDLE Device,
+ [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
+ [In, Out] LPVOID Data,
+ [In, Out] ref INT Size
+ );
+
///
/// Gets information about the raw input device.
///
@@ -965,6 +1048,7 @@ namespace OpenTK.Platform.Windows
/// If Data is not large enough for the data, the function returns -1. If Data is NULL, the function returns a value of zero. In both of these cases, Size is set to the minimum size required for the Data buffer.
/// Call GetLastError to identify any other errors.
///
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputDeviceInfo(
@@ -974,6 +1058,16 @@ namespace OpenTK.Platform.Windows
[In, Out] ref UINT Size
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputDeviceInfo(
+ HANDLE Device,
+ [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
+ [In, Out] RawInputDeviceInfo Data,
+ [In, Out] ref INT Size
+ );
+
+
#endregion
#region GetRawInputData
@@ -999,6 +1093,7 @@ namespace OpenTK.Platform.Windows
///
/// GetRawInputData gets the raw input one RawInput structure at a time. In contrast, GetRawInputBuffer gets an array of RawInput structures.
///
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputData(
@@ -1009,6 +1104,16 @@ namespace OpenTK.Platform.Windows
UINT SizeHeader
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputData(
+ HRAWINPUT RawInput,
+ GetRawInputDataEnum Command,
+ [Out] LPVOID Data,
+ [In, Out] ref INT Size,
+ INT SizeHeader
+ );
+
///
/// Gets the raw input from the specified device.
///
@@ -1030,6 +1135,7 @@ namespace OpenTK.Platform.Windows
///
/// GetRawInputData gets the raw input one RawInput structure at a time. In contrast, GetRawInputBuffer gets an array of RawInput structures.
///
+ [CLSCompliant(false)]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("user32.dll", SetLastError = true)]
public static extern UINT GetRawInputData(
@@ -1040,6 +1146,16 @@ namespace OpenTK.Platform.Windows
UINT SizeHeader
);
+ [System.Security.SuppressUnmanagedCodeSecurity]
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern INT GetRawInputData(
+ HRAWINPUT RawInput,
+ GetRawInputDataEnum Command,
+ [MarshalAs(UnmanagedType.LPStruct)] [Out] RawInput Data,
+ [In, Out] ref INT Size,
+ INT SizeHeader
+ );
+
#endregion
#endregion
@@ -1464,7 +1580,7 @@ namespace OpenTK.Platform.Windows
#region RawInputDevice
- public static readonly uint RawInputDeviceSize;
+ public static readonly int RawInputDeviceSize;
///
/// Defines information for the raw input devices.
@@ -1478,11 +1594,13 @@ namespace OpenTK.Platform.Windows
///
/// Top level collection Usage page for the raw input device.
///
- public USHORT UsagePage;
+ //public USHORT UsagePage;
+ public SHORT UsagePage;
///
/// Top level collection Usage for the raw input device.
///
- public USHORT Usage;
+ //public USHORT Usage;
+ public SHORT Usage;
///
/// Mode flag that specifies how to interpret the information provided by UsagePage and Usage.
/// It can be zero (the default) or one of the following values.
@@ -1505,7 +1623,7 @@ namespace OpenTK.Platform.Windows
#region RawInputDeviceList
- public static readonly uint RawInputDeviceListSize;
+ public static readonly int RawInputDeviceListSize;
///
/// Contains information about a raw input device.
@@ -1532,7 +1650,7 @@ namespace OpenTK.Platform.Windows
#region RawInput
- public static uint RawInputSize;
+ public static int RawInputSize;
///
/// Contains the raw input from a device.
@@ -1565,7 +1683,7 @@ namespace OpenTK.Platform.Windows
#region RawInputHeader
- public static readonly uint RawInputHeaderSize;
+ public static readonly int RawInputHeaderSize;
///
/// Contains the header information that is part of the raw input data.
@@ -1607,7 +1725,8 @@ namespace OpenTK.Platform.Windows
///
/// Scan code from the key depression. The scan code for keyboard overrun is KEYBOARD_OVERRUN_MAKE_CODE.
///
- public USHORT MakeCode;
+ //public USHORT MakeCode;
+ public SHORT MakeCode;
///
/// Flags for scan code information. It can be one or more of the following.
/// RI_KEY_MAKE
@@ -1630,11 +1749,13 @@ namespace OpenTK.Platform.Windows
///
/// Corresponding window message, for example WM_KEYDOWN, WM_SYSKEYDOWN, and so forth.
///
- public UINT Message;
+ //public UINT Message;
+ public INT Message;
///
/// Device-specific additional information for the event.
///
- public ULONG ExtraInformation;
+ //public ULONG ExtraInformation;
+ public LONG ExtraInformation;
}
#endregion
@@ -1659,7 +1780,8 @@ namespace OpenTK.Platform.Windows
/// Mouse coordinates are mapped to the virtual desktop (for a multiple monitor system).
///
[FieldOffset(0)]
- public USHORT Flags;
+ //public USHORT Flags;
+ public SHORT Flags;
///
/// Reserved.
///
@@ -1674,12 +1796,14 @@ namespace OpenTK.Platform.Windows
/// If usButtonFlags is RI_MOUSE_WHEEL, this member is a signed value that specifies the wheel delta.
///
[FieldOffset(4)]
- public USHORT ButtonData;
+ //public USHORT ButtonData;
+ public SHORT ButtonData;
///
/// Raw state of the mouse buttons.
///
[FieldOffset(6)]
- public ULONG RawButtons;
+ //public ULONG RawButtons;
+ public LONG RawButtons;
///
/// Motion in the X direction. This is signed relative motion or absolute motion, depending on the value of usFlags.
///
@@ -1694,7 +1818,8 @@ namespace OpenTK.Platform.Windows
/// Device-specific additional information for the event.
///
[FieldOffset(18)]
- public ULONG ExtraInformation;
+ //public ULONG ExtraInformation;
+ public LONG ExtraInformation;
}
#endregion
@@ -1731,7 +1856,7 @@ namespace OpenTK.Platform.Windows
#region RawInputDeviceInfo
- public static readonly uint RawInputDeviceInfoSize;
+ public static readonly int RawInputDeviceInfoSize;
///
/// Defines the raw input data coming from any device.
@@ -1785,11 +1910,13 @@ namespace OpenTK.Platform.Windows
///
/// Top-level collection Usage Page for the device.
///
- public USHORT UsagePage;
+ //public USHORT UsagePage;
+ public SHORT UsagePage;
///
/// Top-level collection Usage for the device.
///
- public USHORT Usage;
+ //public USHORT Usage;
+ public SHORT Usage;
}
#endregion
@@ -2060,7 +2187,7 @@ namespace OpenTK.Platform.Windows
#region RawInputMouseState
- public enum RawInputMouseState : ushort
+ public enum RawInputMouseState : short// : ushort
{
LEFT_BUTTON_DOWN = 0x0001, // Left Button changed to down.
LEFT_BUTTON_UP = 0x0002, // Left Button changed to up.
@@ -2088,7 +2215,7 @@ namespace OpenTK.Platform.Windows
#region RawInputKeyboardDataFlags
- public enum RawInputKeyboardDataFlags : ushort
+ public enum RawInputKeyboardDataFlags : short //: ushort
{
MAKE = 0,
BREAK = 1,
diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs
index 94b60685..6c47c925 100644
--- a/Source/OpenTK/Platform/Windows/WinGLNative.cs
+++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -214,7 +214,7 @@ namespace OpenTK.Platform.Windows
///
public void Exit()
{
- API.PostMessage(this.Handle, (uint)API.Constants.WM_DESTROY, IntPtr.Zero, IntPtr.Zero);
+ API.PostMessage(this.Handle, API.Constants.WM_DESTROY, IntPtr.Zero, IntPtr.Zero);
}
#endregion
diff --git a/Source/OpenTK/Platform/Windows/WinRawInput.cs b/Source/OpenTK/Platform/Windows/WinRawInput.cs
index cccfdb11..c1e741cf 100644
--- a/Source/OpenTK/Platform/Windows/WinRawInput.cs
+++ b/Source/OpenTK/Platform/Windows/WinRawInput.cs
@@ -44,9 +44,9 @@ namespace OpenTK.Platform.Windows
Debug.Unindent();
}
- private static uint deviceCount;
+ private static int deviceCount;
- internal static uint DeviceCount
+ internal static int DeviceCount
{
get
{
@@ -83,7 +83,7 @@ namespace OpenTK.Platform.Windows
*/
#region protected override void WndProc(ref Message msg)
- uint size = 0;
+ int size = 0;
///
/// Processes the input Windows Message, routing the data to the correct Keyboard, Mouse or HID.
diff --git a/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs b/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs
index 7dd91ab3..ecd7c5f5 100644
--- a/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs
+++ b/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs
@@ -155,7 +155,7 @@ namespace OpenTK.Platform.Windows
internal void UpdateKeyboardList()
{
- uint count = WinRawInput.DeviceCount;
+ int count = WinRawInput.DeviceCount;
API.RawInputDeviceList[] ridl = new API.RawInputDeviceList[count];
for (int i = 0; i < count; i++)
ridl[i] = new API.RawInputDeviceList();
@@ -209,7 +209,7 @@ namespace OpenTK.Platform.Windows
// Register the keyboard:
API.RawInputDeviceInfo info = new API.RawInputDeviceInfo();
- uint devInfoSize = API.RawInputDeviceInfoSize;
+ int devInfoSize = API.RawInputDeviceInfoSize;
API.GetRawInputDeviceInfo(ridl[i].Device, API.RawInputDeviceInfoEnum.DEVICEINFO,
info, ref devInfoSize);