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