mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Simplify various apis in OpenTK.
This commit is contained in:
parent
12814a308b
commit
09912f3d79
@ -474,7 +474,7 @@ namespace OpenTK
|
||||
/// </summary>
|
||||
public KeyboardDevice Keyboard
|
||||
{
|
||||
get { return InputDriver.Keyboard.Count > 0 ? InputDriver.Keyboard[0] : null; }
|
||||
get { return InputDriver.Keyboard; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -484,9 +484,8 @@ namespace OpenTK
|
||||
/// <summary>
|
||||
/// Gets the primary Mouse device, or null if no Mouse exists.
|
||||
/// </summary>
|
||||
public MouseDevice Mouse
|
||||
{
|
||||
get { return InputDriver.Mouse.Count > 0 ? InputDriver.Mouse[0] : null; }
|
||||
public MouseDevice Mouse {
|
||||
get { return InputDriver.Mouse; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -13,9 +13,6 @@ namespace OpenTK.Input {
|
||||
/// <summary> Defines a common interface for all input devices. </summary>
|
||||
public interface IInputDevice {
|
||||
|
||||
/// <summary> Gets a System.String with a unique description of this IInputDevice instance. </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary> Gets an OpenTK.Input.InputDeviceType value, representing the device type of this IInputDevice instance. </summary>
|
||||
InputDeviceType DeviceType { get; }
|
||||
}
|
||||
@ -32,10 +29,18 @@ namespace OpenTK.Input {
|
||||
}
|
||||
|
||||
/// <summary> Defines the interface for an input driver. </summary>
|
||||
public interface IInputDriver : IKeyboardDriver, IMouseDriver, IJoystickDriver, IDisposable {
|
||||
public interface IInputDriver : IJoystickDriver, IDisposable {
|
||||
|
||||
/// <summary> Gets the list of available KeyboardDevices. </summary>
|
||||
KeyboardDevice Keyboard { get; }
|
||||
|
||||
/// <summary> Gets the list of available MouseDevices. </summary>
|
||||
MouseDevice Mouse { get; }
|
||||
|
||||
/// <summary> Updates the state of the driver. </summary>
|
||||
void Poll();
|
||||
|
||||
Point DesktopCursorPos { get; set; }
|
||||
}
|
||||
|
||||
/// <summary> Defines the interface for JoystickDevice drivers. </summary>
|
||||
@ -44,20 +49,4 @@ namespace OpenTK.Input {
|
||||
/// <summary> Gets the list of available JoystickDevices. </summary>
|
||||
IList<JoystickDevice> Joysticks { get; }
|
||||
}
|
||||
|
||||
/// <summary> Defines the interface for KeyboardDevice drivers. </summary>
|
||||
public interface IKeyboardDriver {
|
||||
|
||||
/// <summary> Gets the list of available KeyboardDevices. </summary>
|
||||
IList<KeyboardDevice> Keyboard { get; }
|
||||
}
|
||||
|
||||
/// <summary> Defines the interface for MouseDevice drivers. </summary>
|
||||
public interface IMouseDriver {
|
||||
|
||||
/// <summary> Gets the list of available MouseDevices. </summary>
|
||||
IList<MouseDevice> Mouse { get; }
|
||||
|
||||
Point DesktopCursorPos { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// The available keyboard keys.
|
||||
/// </summary>
|
||||
/// <summary> The available keyboard keys. </summary>
|
||||
public enum Key : int
|
||||
{
|
||||
/// <summary>A key outside the known keys.</summary>
|
||||
|
@ -13,11 +13,7 @@ namespace OpenTK.Input
|
||||
/// </summary>
|
||||
public sealed class KeyboardDevice : IInputDevice
|
||||
{
|
||||
//private IKeyboard keyboard;
|
||||
private bool[] keys = new bool[(int)Key.LastKey];
|
||||
private string description;
|
||||
private int numKeys, numFKeys, numLeds;
|
||||
private IntPtr devID;
|
||||
private bool repeat;
|
||||
private KeyboardKeyEventArgs args = new KeyboardKeyEventArgs();
|
||||
|
||||
@ -57,42 +53,6 @@ namespace OpenTK.Input
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an integer representing the number of keys on this KeyboardDevice.
|
||||
/// </summary>
|
||||
public int NumberOfKeys
|
||||
{
|
||||
get { return numKeys; }
|
||||
internal set { numKeys = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an integer representing the number of function keys (F-keys) on this KeyboardDevice.
|
||||
/// </summary>
|
||||
public int NumberOfFunctionKeys
|
||||
{
|
||||
get { return numFKeys; }
|
||||
internal set { numFKeys = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating the number of led indicators on this KeyboardDevice.
|
||||
/// </summary>
|
||||
public int NumberOfLeds
|
||||
{
|
||||
get { return numLeds; }
|
||||
internal set { numLeds = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an IntPtr representing a device dependent ID.
|
||||
/// </summary>
|
||||
public IntPtr DeviceID
|
||||
{
|
||||
get { return devID; }
|
||||
internal set { devID = value; }
|
||||
}
|
||||
|
||||
#region public bool KeyRepeat
|
||||
|
||||
/// <summary>
|
||||
@ -139,50 +99,10 @@ namespace OpenTK.Input
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IInputDevice Members ---
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="System.String"/> which describes this instance.
|
||||
/// </summary>
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
internal set { description = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="InputDeviceType"/> for this instance.
|
||||
/// </summary>
|
||||
public InputDeviceType DeviceType
|
||||
{
|
||||
public InputDeviceType DeviceType {
|
||||
get { return InputDeviceType.Keyboard; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Public Methods ---
|
||||
|
||||
/// <summary>Returns the hash code for this KeyboardDevice.</summary>
|
||||
/// <returns>A 32-bit signed integer hash code.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
//return base.GetHashCode();
|
||||
return (int)(numKeys ^ numFKeys ^ numLeds ^ devID.GetHashCode() ^ description.GetHashCode());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a System.String representing this KeyboardDevice.
|
||||
/// </summary>
|
||||
/// <returns>A System.String representing this KeyboardDevice.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
//return base.ToString();
|
||||
return String.Format("ID: {0} ({1}). Keys: {2}, Function keys: {3}, Leds: {4}",
|
||||
DeviceID, Description, NumberOfKeys, NumberOfFunctionKeys, NumberOfLeds);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Internal Methods ---
|
||||
|
||||
#region internal void ClearKeys()
|
||||
|
@ -35,90 +35,19 @@ namespace OpenTK.Input
|
||||
/// </summary>
|
||||
public sealed class MouseDevice : IInputDevice
|
||||
{
|
||||
#region --- Fields ---
|
||||
|
||||
string description;
|
||||
IntPtr id;
|
||||
int numButtons, numWheels;
|
||||
readonly bool[] button_state = new bool[(int)MouseButton.LastButton];
|
||||
float wheel, last_wheel;
|
||||
Point pos = new Point(), last_pos = new Point();
|
||||
Point pos, last_pos;
|
||||
MouseMoveEventArgs move_args = new MouseMoveEventArgs();
|
||||
MouseButtonEventArgs button_args = new MouseButtonEventArgs();
|
||||
MouseWheelEventArgs wheel_args = new MouseWheelEventArgs();
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IInputDevice Members ---
|
||||
|
||||
#region public string Description
|
||||
|
||||
/// <summary>
|
||||
/// Gets a string describing this MouseDevice.
|
||||
/// </summary>
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
internal set { description = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public InputDeviceType DeviceType
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating the InputDeviceType of this InputDevice.
|
||||
/// </summary>
|
||||
public InputDeviceType DeviceType
|
||||
{
|
||||
public InputDeviceType DeviceType {
|
||||
get { return InputDeviceType.Mouse; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Public Members ---
|
||||
|
||||
#region public int NumberOfButtons
|
||||
|
||||
/// <summary>
|
||||
/// Gets an integer representing the number of buttons on this MouseDevice.
|
||||
/// </summary>
|
||||
public int NumberOfButtons
|
||||
{
|
||||
get { return numButtons; }
|
||||
internal set { numButtons = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public int NumberOfWheels
|
||||
|
||||
/// <summary>
|
||||
/// Gets an integer representing the number of wheels on this MouseDevice.
|
||||
/// </summary>
|
||||
public int NumberOfWheels
|
||||
{
|
||||
get { return numWheels; }
|
||||
internal set { numWheels = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public IntPtr DeviceID
|
||||
|
||||
/// <summary>
|
||||
/// Gets an IntPtr representing a device dependent ID.
|
||||
/// </summary>
|
||||
public IntPtr DeviceID
|
||||
{
|
||||
get { return id; }
|
||||
internal set { id = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public int Wheel
|
||||
|
||||
/// <summary>
|
||||
@ -258,29 +187,6 @@ namespace OpenTK.Input
|
||||
/// </summary>
|
||||
public event EventHandler<MouseWheelEventArgs> WheelChanged = delegate { };
|
||||
|
||||
#region --- Overrides ---
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the hash code for this instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (int)(numButtons ^ numWheels ^ id.GetHashCode() ^ description.GetHashCode());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String"/> that describes this instance.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="System.String"/> that describes this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("ID: {0} ({1}). Buttons: {2}, Wheels: {3}",
|
||||
DeviceID, Description, NumberOfButtons, NumberOfWheels);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,6 @@
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\MacOSKeys.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\QuartzDisplayServicesAPI.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonGLNative.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonInput.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonWindowInfo.cs" />
|
||||
<Compile Include="Platform\MacOS\EventInfo.cs" />
|
||||
<Compile Include="Platform\MacOS\MacOSException.cs" />
|
||||
|
@ -209,7 +209,7 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||
MouseExited = 9,
|
||||
WheelMoved = 10,
|
||||
}
|
||||
internal enum MouseButton : short
|
||||
internal enum MacOSMouseButton : short
|
||||
{
|
||||
Primary = 1,
|
||||
Secondary = 2,
|
||||
@ -586,190 +586,110 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||
#endregion
|
||||
#region --- Getting Event Parameters ---
|
||||
|
||||
[DllImport(carbon,EntryPoint="CreateEvent")]
|
||||
static extern OSStatus _CreateEvent( IntPtr inAllocator,
|
||||
[DllImport(carbon)]
|
||||
static extern OSStatus CreateEvent( IntPtr inAllocator,
|
||||
EventClass inClassID, UInt32 kind, EventTime when,
|
||||
EventAttributes flags,out IntPtr outEvent);
|
||||
EventAttributes flags, out IntPtr outEvent);
|
||||
|
||||
internal static IntPtr CreateWindowEvent(WindowEventKind kind)
|
||||
{
|
||||
internal static IntPtr CreateWindowEvent(WindowEventKind kind) {
|
||||
IntPtr retval;
|
||||
|
||||
OSStatus stat = _CreateEvent(IntPtr.Zero, EventClass.Window, (uint)kind,
|
||||
0, EventAttributes.kEventAttributeNone, out retval);
|
||||
OSStatus stat = CreateEvent(IntPtr.Zero, EventClass.Window, (uint)kind,
|
||||
0, EventAttributes.kEventAttributeNone, out retval);
|
||||
|
||||
if (stat != OSStatus.NoError)
|
||||
{
|
||||
throw new MacOSException(stat);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
[DllImport(carbon)]
|
||||
static extern OSStatus GetEventParameter(
|
||||
IntPtr inEvent, EventParamName inName, EventParamType inDesiredType,
|
||||
IntPtr outActualType, uint inBufferSize, IntPtr outActualSize, IntPtr outData);
|
||||
[DllImport(carbon)]
|
||||
static extern OSStatus GetEventParameter(
|
||||
IntPtr inEvent, EventParamName inName, EventParamType inDesiredType,
|
||||
IntPtr outActualType, int inBufferSize, IntPtr outActualSize, IntPtr outData);
|
||||
|
||||
static internal MacOSKeyCode GetEventKeyboardKeyCode(IntPtr inEvent)
|
||||
{
|
||||
int code;
|
||||
internal unsafe static MacOSKeyCode GetEventKeyboardKeyCode(IntPtr inEvent) {
|
||||
int code;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.KeyCode, EventParamType.typeUInt32, IntPtr.Zero,
|
||||
sizeof(uint), IntPtr.Zero, (IntPtr)(void*)&code);
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* codeAddr = &code;
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
return (MacOSKeyCode)code;
|
||||
}
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.KeyCode, EventParamType.typeUInt32, IntPtr.Zero,
|
||||
(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(UInt32)), IntPtr.Zero,
|
||||
(IntPtr) codeAddr);
|
||||
internal unsafe static char GetEventKeyboardChar(IntPtr inEvent) {
|
||||
char code;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero,
|
||||
Marshal.SizeOf(typeof(char)), IntPtr.Zero, (IntPtr)(void*)&code);
|
||||
|
||||
if (result != OSStatus.NoError)
|
||||
{
|
||||
throw new MacOSException(result);
|
||||
}
|
||||
}
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
return code;
|
||||
}
|
||||
|
||||
return (MacOSKeyCode)code;
|
||||
}
|
||||
internal unsafe static MacOSMouseButton GetEventMouseButton(IntPtr inEvent) {
|
||||
int button;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.MouseButton, EventParamType.typeMouseButton, IntPtr.Zero,
|
||||
sizeof(short), IntPtr.Zero, (IntPtr)(void*)&button);
|
||||
|
||||
internal static char GetEventKeyboardChar(IntPtr inEvent)
|
||||
{
|
||||
char code;
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
return (MacOSMouseButton)button;
|
||||
}
|
||||
|
||||
unsafe
|
||||
{
|
||||
char* codeAddr = &code;
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero,
|
||||
(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(char)), IntPtr.Zero,
|
||||
(IntPtr)codeAddr);
|
||||
|
||||
if (result != OSStatus.NoError)
|
||||
{
|
||||
throw new MacOSException(result);
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static internal MouseButton GetEventMouseButton(IntPtr inEvent)
|
||||
{
|
||||
int button;
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* btn = &button;
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.MouseButton, EventParamType.typeMouseButton, IntPtr.Zero,
|
||||
(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(short)), IntPtr.Zero,
|
||||
(IntPtr)btn);
|
||||
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
}
|
||||
|
||||
return (MouseButton)button;
|
||||
}
|
||||
static internal int GetEventMouseWheelDelta(IntPtr inEvent)
|
||||
{
|
||||
internal unsafe static int GetEventMouseWheelDelta(IntPtr inEvent) {
|
||||
int delta;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.MouseWheelDelta, EventParamType.typeSInt32,
|
||||
IntPtr.Zero, sizeof(int), IntPtr.Zero, (IntPtr)(void*)&delta);
|
||||
|
||||
unsafe
|
||||
{
|
||||
int* d = δ
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.MouseWheelDelta, EventParamType.typeSInt32,
|
||||
IntPtr.Zero, (uint)sizeof(int), IntPtr.Zero, (IntPtr)d);
|
||||
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
}
|
||||
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
return delta;
|
||||
}
|
||||
|
||||
static internal OSStatus GetEventWindowMouseLocation(IntPtr inEvent, out HIPoint pt)
|
||||
{
|
||||
HIPoint point;
|
||||
internal unsafe static OSStatus GetEventWindowMouseLocation(IntPtr inEvent, out HIPoint pt) {
|
||||
HIPoint point;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.WindowMouseLocation, EventParamType.typeHIPoint, IntPtr.Zero,
|
||||
Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero, (IntPtr)(void*)&point);
|
||||
|
||||
unsafe
|
||||
{
|
||||
HIPoint* parm = &point;
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.WindowMouseLocation, EventParamType.typeHIPoint, IntPtr.Zero,
|
||||
(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero,
|
||||
(IntPtr)parm);
|
||||
|
||||
pt = point;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static internal OSStatus GetEventWindowRef(IntPtr inEvent, out IntPtr windowRef)
|
||||
{
|
||||
IntPtr retval;
|
||||
|
||||
unsafe
|
||||
{
|
||||
IntPtr* parm = &retval;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.WindowRef, EventParamType.typeWindowRef, IntPtr.Zero,
|
||||
(uint)sizeof(IntPtr), IntPtr.Zero, (IntPtr)parm);
|
||||
|
||||
windowRef = retval;
|
||||
|
||||
return result;
|
||||
}
|
||||
pt = point;
|
||||
return result;
|
||||
}
|
||||
|
||||
static internal OSStatus GetEventMouseLocation(IntPtr inEvent, out HIPoint pt)
|
||||
{
|
||||
HIPoint point;
|
||||
internal unsafe static OSStatus GetEventWindowRef(IntPtr inEvent, out IntPtr windowRef) {
|
||||
IntPtr retval;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.WindowRef, EventParamType.typeWindowRef, IntPtr.Zero,
|
||||
sizeof(IntPtr), IntPtr.Zero, (IntPtr)(void*)&retval);
|
||||
|
||||
unsafe
|
||||
{
|
||||
HIPoint* parm = &point;
|
||||
windowRef = retval;
|
||||
return result;
|
||||
}
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.MouseLocation, EventParamType.typeHIPoint, IntPtr.Zero,
|
||||
(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero,
|
||||
(IntPtr)parm);
|
||||
internal unsafe static OSStatus GetEventMouseLocation(IntPtr inEvent, out HIPoint pt) {
|
||||
HIPoint point;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.MouseLocation, EventParamType.typeHIPoint, IntPtr.Zero,
|
||||
Marshal.SizeOf(typeof(HIPoint)), IntPtr.Zero, (IntPtr)(void*)&point);
|
||||
|
||||
pt = point;
|
||||
pt = point;
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
internal unsafe static MacOSKeyModifiers GetEventKeyModifiers(IntPtr inEvent) {
|
||||
uint code;
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.KeyModifiers, EventParamType.typeUInt32, IntPtr.Zero,
|
||||
sizeof(uint), IntPtr.Zero, (IntPtr)(void*)&code);
|
||||
|
||||
}
|
||||
static internal MacOSKeyModifiers GetEventKeyModifiers(IntPtr inEvent)
|
||||
{
|
||||
uint code;
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* codeAddr = &code;
|
||||
|
||||
OSStatus result = API.GetEventParameter(inEvent,
|
||||
EventParamName.KeyModifiers, EventParamType.typeUInt32, IntPtr.Zero,
|
||||
(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(uint)), IntPtr.Zero,
|
||||
(IntPtr)codeAddr);
|
||||
|
||||
if (result != OSStatus.NoError)
|
||||
{
|
||||
throw new MacOSException(result);
|
||||
}
|
||||
}
|
||||
|
||||
return (MacOSKeyModifiers)code;
|
||||
}
|
||||
if (result != OSStatus.NoError)
|
||||
throw new MacOSException(result);
|
||||
return (MacOSKeyModifiers)code;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region --- Event Handlers ---
|
||||
|
@ -32,18 +32,16 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform.MacOS.Carbon;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
{
|
||||
class CarbonGLNative : INativeWindow
|
||||
class CarbonGLNative : INativeWindow, IInputDriver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
CarbonWindowInfo window;
|
||||
CarbonInput mInputDriver;
|
||||
|
||||
static MacOSKeyMap Keymap = new MacOSKeyMap();
|
||||
|
||||
IntPtr uppHandler;
|
||||
|
||||
string title = "OpenTK Window";
|
||||
@ -108,6 +106,7 @@ namespace OpenTK.Platform.MacOS
|
||||
new Rect((short)x, (short)y, (short)width, (short)height));
|
||||
|
||||
mDisplayDevice = device;
|
||||
dummy_joystick_list.Add(new JoystickDevice<object>(0, 0, 0));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -196,8 +195,6 @@ namespace OpenTK.Platform.MacOS
|
||||
|
||||
void ConnectEvents()
|
||||
{
|
||||
mInputDriver = new CarbonInput();
|
||||
|
||||
EventTypeSpec[] eventTypes = new EventTypeSpec[]
|
||||
{
|
||||
new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClose),
|
||||
@ -369,17 +366,16 @@ namespace OpenTK.Platform.MacOS
|
||||
switch (evt.KeyboardEventKind)
|
||||
{
|
||||
case KeyboardEventKind.RawKeyRepeat:
|
||||
InputDriver.Keyboard[0].KeyRepeat = true;
|
||||
keyboard.KeyRepeat = true;
|
||||
goto case KeyboardEventKind.RawKeyDown;
|
||||
|
||||
case KeyboardEventKind.RawKeyDown:
|
||||
OnKeyPress(mKeyPressArgs);
|
||||
InputDriver.Keyboard[0][Keymap[code]] = true;
|
||||
keyboard[Keymap[code]] = true;
|
||||
return OSStatus.NoError;
|
||||
|
||||
case KeyboardEventKind.RawKeyUp:
|
||||
InputDriver.Keyboard[0][Keymap[code]] = false;
|
||||
|
||||
keyboard[Keymap[code]] = false;
|
||||
return OSStatus.NoError;
|
||||
|
||||
case KeyboardEventKind.RawKeyModifiersChanged:
|
||||
@ -441,8 +437,8 @@ namespace OpenTK.Platform.MacOS
|
||||
}
|
||||
protected OSStatus ProcessMouseEvent(IntPtr inCaller, IntPtr inEvent, EventInfo evt, IntPtr userData)
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(evt.EventClass == EventClass.Mouse);
|
||||
MouseButton button = MouseButton.Primary;
|
||||
Debug.Assert(evt.EventClass == EventClass.Mouse);
|
||||
MacOSMouseButton button;
|
||||
HIPoint pt = new HIPoint();
|
||||
HIPoint screenLoc = new HIPoint();
|
||||
|
||||
@ -484,20 +480,18 @@ namespace OpenTK.Platform.MacOS
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case MouseButton.Primary:
|
||||
InputDriver.Mouse[0][OpenTK.Input.MouseButton.Left] = true;
|
||||
case MacOSMouseButton.Primary:
|
||||
mouse[MouseButton.Left] = true;
|
||||
break;
|
||||
|
||||
case MouseButton.Secondary:
|
||||
InputDriver.Mouse[0][OpenTK.Input.MouseButton.Right] = true;
|
||||
case MacOSMouseButton.Secondary:
|
||||
mouse[MouseButton.Right] = true;
|
||||
break;
|
||||
|
||||
case MouseButton.Tertiary:
|
||||
InputDriver.Mouse[0][OpenTK.Input.MouseButton.Middle] = true;
|
||||
case MacOSMouseButton.Tertiary:
|
||||
mouse[MouseButton.Middle] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return OSStatus.NoError;
|
||||
|
||||
case MouseEventKind.MouseUp:
|
||||
@ -505,29 +499,25 @@ namespace OpenTK.Platform.MacOS
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case MouseButton.Primary:
|
||||
InputDriver.Mouse[0][OpenTK.Input.MouseButton.Left] = false;
|
||||
case MacOSMouseButton.Primary:
|
||||
mouse[MouseButton.Left] = false;
|
||||
break;
|
||||
|
||||
case MouseButton.Secondary:
|
||||
InputDriver.Mouse[0][OpenTK.Input.MouseButton.Right] = false;
|
||||
case MacOSMouseButton.Secondary:
|
||||
mouse[MouseButton.Right] = false;
|
||||
break;
|
||||
|
||||
case MouseButton.Tertiary:
|
||||
InputDriver.Mouse[0][OpenTK.Input.MouseButton.Middle] = false;
|
||||
case MacOSMouseButton.Tertiary:
|
||||
mouse[MouseButton.Middle] = false;
|
||||
break;
|
||||
}
|
||||
|
||||
button = API.GetEventMouseButton(inEvent);
|
||||
|
||||
return OSStatus.NoError;
|
||||
|
||||
case MouseEventKind.WheelMoved:
|
||||
|
||||
int delta = API.GetEventMouseWheelDelta(inEvent) / 3;
|
||||
|
||||
InputDriver.Mouse[0].Wheel += delta;
|
||||
|
||||
mouse.Wheel += delta;
|
||||
return OSStatus.NoError;
|
||||
|
||||
case MouseEventKind.MouseMoved:
|
||||
@ -535,32 +525,23 @@ namespace OpenTK.Platform.MacOS
|
||||
|
||||
//Debug.Print("Mouse Location: {0}, {1}", pt.X, pt.Y);
|
||||
|
||||
if (this.windowState == WindowState.Fullscreen)
|
||||
{
|
||||
if (mousePosInClient.X != InputDriver.Mouse[0].X ||
|
||||
mousePosInClient.Y != InputDriver.Mouse[0].Y)
|
||||
{
|
||||
InputDriver.Mouse[0].Position = mousePosInClient;
|
||||
if (windowState == WindowState.Fullscreen) {
|
||||
if (mousePosInClient.X != mouse.X || mousePosInClient.Y != mouse.Y) {
|
||||
mouse.Position = mousePosInClient;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// ignore clicks in the title bar
|
||||
if (pt.Y < 0)
|
||||
return OSStatus.EventNotHandled;
|
||||
|
||||
if (mousePosInClient.X != InputDriver.Mouse[0].X ||
|
||||
mousePosInClient.Y != InputDriver.Mouse[0].Y)
|
||||
{
|
||||
InputDriver.Mouse[0].Position = mousePosInClient;
|
||||
if (mousePosInClient.X != mouse.X || mousePosInClient.Y != mouse.Y) {
|
||||
mouse.Position = mousePosInClient;
|
||||
}
|
||||
}
|
||||
|
||||
return OSStatus.EventNotHandled;
|
||||
|
||||
default:
|
||||
Debug.Print("{0}", evt);
|
||||
|
||||
return OSStatus.EventNotHandled;
|
||||
}
|
||||
}
|
||||
@ -591,6 +572,7 @@ namespace OpenTK.Platform.MacOS
|
||||
code = API.GetEventKeyboardKeyCode(inEvent);
|
||||
charCode = API.GetEventKeyboardChar(inEvent);
|
||||
}
|
||||
|
||||
private void ProcessModifierKey(IntPtr inEvent)
|
||||
{
|
||||
MacOSKeyModifiers modifiers = API.GetEventKeyModifiers(inEvent);
|
||||
@ -603,42 +585,35 @@ namespace OpenTK.Platform.MacOS
|
||||
|
||||
Debug.Print("Modifiers Changed: {0}", modifiers);
|
||||
|
||||
Input.KeyboardDevice keyboard = InputDriver.Keyboard[0];
|
||||
if (keyboard[Key.AltLeft] ^ option)
|
||||
keyboard[Key.AltLeft] = option;
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.AltLeft] ^ option)
|
||||
keyboard[OpenTK.Input.Key.AltLeft] = option;
|
||||
if (keyboard[Key.ShiftLeft] ^ shift)
|
||||
keyboard[Key.ShiftLeft] = shift;
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.ShiftLeft] ^ shift)
|
||||
keyboard[OpenTK.Input.Key.ShiftLeft] = shift;
|
||||
if (keyboard[Key.WinLeft] ^ command)
|
||||
keyboard[Key.WinLeft] = command;
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.WinLeft] ^ command)
|
||||
keyboard[OpenTK.Input.Key.WinLeft] = command;
|
||||
if (keyboard[Key.ControlLeft] ^ control)
|
||||
keyboard[Key.ControlLeft] = control;
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.ControlLeft] ^ control)
|
||||
keyboard[OpenTK.Input.Key.ControlLeft] = control;
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.CapsLock] ^ caps)
|
||||
keyboard[OpenTK.Input.Key.CapsLock] = caps;
|
||||
if (keyboard[Key.CapsLock] ^ caps)
|
||||
keyboard[Key.CapsLock] = caps;
|
||||
|
||||
}
|
||||
|
||||
Rect GetRegion()
|
||||
{
|
||||
Rect retval = API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
|
||||
|
||||
return retval;
|
||||
Rect GetRegion() {
|
||||
return API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
|
||||
}
|
||||
|
||||
void SetLocation(short x, short y)
|
||||
{
|
||||
void SetLocation(short x, short y) {
|
||||
if (windowState == WindowState.Fullscreen)
|
||||
return;
|
||||
|
||||
API.MoveWindow(window.WindowRef, x, y, false);
|
||||
}
|
||||
|
||||
void SetSize(short width, short height)
|
||||
{
|
||||
void SetSize(short width, short height) {
|
||||
if (WindowState == WindowState.Fullscreen)
|
||||
return;
|
||||
|
||||
@ -651,26 +626,21 @@ namespace OpenTK.Platform.MacOS
|
||||
API.SizeWindow(window.WindowRef, width, height, true);
|
||||
}
|
||||
|
||||
void SetClientSize(short width, short height)
|
||||
{
|
||||
void SetClientSize(short width, short height) {
|
||||
if (WindowState == WindowState.Fullscreen)
|
||||
return;
|
||||
|
||||
API.SizeWindow(window.WindowRef, width, height, true);
|
||||
}
|
||||
|
||||
protected void OnResize()
|
||||
{
|
||||
protected void OnResize() {
|
||||
LoadSize();
|
||||
|
||||
if (Resize != null)
|
||||
{
|
||||
if (Resize != null) {
|
||||
Resize(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadSize()
|
||||
{
|
||||
private void LoadSize() {
|
||||
if (WindowState == WindowState.Fullscreen)
|
||||
return;
|
||||
|
||||
@ -724,15 +694,10 @@ namespace OpenTK.Platform.MacOS
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public OpenTK.Input.IInputDriver InputDriver
|
||||
{
|
||||
get
|
||||
{
|
||||
return mInputDriver;
|
||||
}
|
||||
public IInputDriver InputDriver {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
|
||||
public Icon Icon
|
||||
{
|
||||
get { return mIcon; }
|
||||
@ -836,28 +801,14 @@ namespace OpenTK.Platform.MacOS
|
||||
}
|
||||
}
|
||||
|
||||
public Point Location
|
||||
{
|
||||
get
|
||||
{
|
||||
return Bounds.Location;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetLocation((short)value.X, (short)value.Y);
|
||||
}
|
||||
public Point Location {
|
||||
get { return Bounds.Location; }
|
||||
set { SetLocation((short)value.X, (short)value.Y); }
|
||||
}
|
||||
|
||||
public Size Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return bounds.Size;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetSize((short)value.Width, (short)value.Height);
|
||||
}
|
||||
public Size Size {
|
||||
get { return bounds.Size; }
|
||||
set { SetSize((short)value.Width, (short)value.Height); }
|
||||
}
|
||||
|
||||
public int Width
|
||||
@ -872,28 +823,14 @@ namespace OpenTK.Platform.MacOS
|
||||
set { SetClientSize((short)Width, (short)value); }
|
||||
}
|
||||
|
||||
public int X
|
||||
{
|
||||
get
|
||||
{
|
||||
return ClientRectangle.X;
|
||||
}
|
||||
set
|
||||
{
|
||||
Location = new Point(value, Y);
|
||||
}
|
||||
public int X {
|
||||
get { return ClientRectangle.X; }
|
||||
set { Location = new Point(value, Y); }
|
||||
}
|
||||
|
||||
public int Y
|
||||
{
|
||||
get
|
||||
{
|
||||
return ClientRectangle.Y;
|
||||
}
|
||||
set
|
||||
{
|
||||
Location = new Point(X, value);
|
||||
}
|
||||
public int Y {
|
||||
get { return ClientRectangle.Y; }
|
||||
set { Location = new Point(X, value); }
|
||||
}
|
||||
|
||||
public Rectangle ClientRectangle
|
||||
@ -1124,5 +1061,40 @@ namespace OpenTK.Platform.MacOS
|
||||
public event EventHandler<EventArgs> MouseLeave;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IInputDriver Members
|
||||
|
||||
KeyboardDevice keyboard = new KeyboardDevice();
|
||||
MouseDevice mouse = new MouseDevice();
|
||||
List<JoystickDevice> dummy_joystick_list = new List<JoystickDevice>(1);
|
||||
|
||||
public void Poll() {
|
||||
}
|
||||
|
||||
public KeyboardDevice Keyboard {
|
||||
get { return keyboard; }
|
||||
}
|
||||
|
||||
public MouseDevice Mouse {
|
||||
get { return mouse; }
|
||||
}
|
||||
|
||||
// TODO: Implement using native API, rather than through Mono.
|
||||
// http://webnnel.googlecode.com/svn/trunk/lib/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEventsCore.h
|
||||
// GetPos --> GetGlobalMouse (no 64 bit support?), and HIGetMousePosition()
|
||||
// https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html#//apple_ref/c/func/CGWarpMouseCursorPosition
|
||||
// SetPos --> CGWarpMouseCursorPosition
|
||||
// Note that: CGPoint uses float on 32 bit systems, double on 64 bit systems
|
||||
// The rest of the MacOS OpenTK API will probably need to be fixed for this too...
|
||||
public Point DesktopCursorPos {
|
||||
get { return System.Windows.Forms.Cursor.Position; }
|
||||
set { System.Windows.Forms.Cursor.Position = value; }
|
||||
}
|
||||
|
||||
public IList<JoystickDevice> Joysticks {
|
||||
get { return dummy_joystick_list; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace OpenTK.Platform.MacOS
|
||||
{
|
||||
class CarbonInput : IInputDriver
|
||||
{
|
||||
List<KeyboardDevice> dummy_keyboard_list = new List<KeyboardDevice>(1);
|
||||
List<MouseDevice> dummy_mice_list = new List<MouseDevice>(1);
|
||||
List<JoystickDevice> dummy_joystick_list = new List<JoystickDevice>(1);
|
||||
|
||||
internal CarbonInput()
|
||||
{
|
||||
dummy_mice_list.Add(new MouseDevice());
|
||||
dummy_keyboard_list.Add(new KeyboardDevice());
|
||||
dummy_joystick_list.Add(new JoystickDevice<object>(0, 0, 0));
|
||||
}
|
||||
|
||||
#region IInputDriver Members
|
||||
|
||||
public void Poll()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IKeyboardDriver Members
|
||||
|
||||
public IList<KeyboardDevice> Keyboard
|
||||
{
|
||||
get { return dummy_keyboard_list; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMouseDriver Members
|
||||
|
||||
public IList<MouseDevice> Mouse
|
||||
{
|
||||
get { return dummy_mice_list; }
|
||||
}
|
||||
|
||||
// TODO: Implement using native API, rather than through Mono.
|
||||
// http://webnnel.googlecode.com/svn/trunk/lib/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEventsCore.h
|
||||
// GetPos --> GetGlobalMouse (no 64 bit support?), and HIGetMousePosition()
|
||||
// https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html#//apple_ref/c/func/CGWarpMouseCursorPosition
|
||||
// SetPos --> CGWarpMouseCursorPosition
|
||||
// Note that: CGPoint uses float on 32 bit systems, double on 64 bit systems
|
||||
// The rest of the MacOS OpenTK API will probably need to be fixed for this too...
|
||||
public Point DesktopCursorPos {
|
||||
get { return System.Windows.Forms.Cursor.Position; }
|
||||
set { System.Windows.Forms.Cursor.Position = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IJoystickDriver Members
|
||||
|
||||
public IList<JoystickDevice> Joysticks
|
||||
{
|
||||
get { return dummy_joystick_list; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -78,8 +78,6 @@ namespace OpenTK.Platform.Windows
|
||||
WinMMJoystick joystick_driver = new WinMMJoystick();
|
||||
KeyboardDevice keyboard = new KeyboardDevice();
|
||||
MouseDevice mouse = new MouseDevice();
|
||||
IList<KeyboardDevice> keyboards = new List<KeyboardDevice>(1);
|
||||
IList<MouseDevice> mice = new List<MouseDevice>(1);
|
||||
static readonly WinKeyMap KeyMap = new WinKeyMap();
|
||||
const long ExtendedBit = 1 << 24; // Used to distinguish left and right control, alt and enter keys.
|
||||
static readonly uint ShiftRightScanCode = Functions.MapVirtualKey(VirtualKeys.RSHIFT, 0); // Used to distinguish left and right shift keys.
|
||||
@ -112,18 +110,6 @@ namespace OpenTK.Platform.Windows
|
||||
CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window);
|
||||
|
||||
exists = true;
|
||||
|
||||
keyboard.Description = "Standard Windows keyboard";
|
||||
keyboard.NumberOfFunctionKeys = 12;
|
||||
keyboard.NumberOfKeys = 101;
|
||||
keyboard.NumberOfLeds = 3;
|
||||
|
||||
mouse.Description = "Standard Windows mouse";
|
||||
mouse.NumberOfButtons = 3;
|
||||
mouse.NumberOfWheels = 1;
|
||||
|
||||
keyboards.Add(keyboard);
|
||||
mice.Add(mouse);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -1125,27 +1111,16 @@ namespace OpenTK.Platform.Windows
|
||||
|
||||
#region IInputDriver Members
|
||||
|
||||
public void Poll()
|
||||
{
|
||||
public void Poll() {
|
||||
joystick_driver.Poll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IKeyboardDriver Members
|
||||
|
||||
public IList<KeyboardDevice> Keyboard
|
||||
{
|
||||
get { return keyboards; }
|
||||
public KeyboardDevice Keyboard {
|
||||
get { return keyboard; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMouseDriver Members
|
||||
|
||||
public IList<MouseDevice> Mouse
|
||||
{
|
||||
get { return mice; }
|
||||
public MouseDevice Mouse {
|
||||
get { return mouse; }
|
||||
}
|
||||
|
||||
public Point DesktopCursorPos {
|
||||
|
@ -26,8 +26,6 @@ namespace OpenTK.Platform.X11
|
||||
//X11WindowInfo window;
|
||||
KeyboardDevice keyboard = new KeyboardDevice();
|
||||
MouseDevice mouse = new MouseDevice();
|
||||
List<KeyboardDevice> dummy_keyboard_list = new List<KeyboardDevice>(1);
|
||||
List<MouseDevice> dummy_mice_list = new List<MouseDevice>(1);
|
||||
|
||||
X11KeyMap keymap = new X11KeyMap();
|
||||
int firstKeyCode, lastKeyCode; // The smallest and largest KeyCode supported by the X server.
|
||||
@ -55,13 +53,6 @@ namespace OpenTK.Platform.X11
|
||||
//window = new X11WindowInfo(attach);
|
||||
X11WindowInfo window = (X11WindowInfo)attach;
|
||||
|
||||
// Init mouse
|
||||
mouse.Description = "Default X11 mouse";
|
||||
mouse.DeviceID = IntPtr.Zero;
|
||||
mouse.NumberOfButtons = 5;
|
||||
mouse.NumberOfWheels = 1;
|
||||
dummy_mice_list.Add(mouse);
|
||||
|
||||
using (new XLock(window.Display))
|
||||
{
|
||||
// Init keyboard
|
||||
@ -76,12 +67,6 @@ namespace OpenTK.Platform.X11
|
||||
Marshal.PtrToStructure(keysym_ptr, keysyms);
|
||||
API.Free(keysym_ptr);
|
||||
|
||||
KeyboardDevice kb = new KeyboardDevice();
|
||||
keyboard.Description = "Default X11 keyboard";
|
||||
keyboard.NumberOfKeys = lastKeyCode - firstKeyCode + 1;
|
||||
keyboard.DeviceID = IntPtr.Zero;
|
||||
dummy_keyboard_list.Add(keyboard);
|
||||
|
||||
// Request that auto-repeat is only set on devices that support it physically.
|
||||
// This typically means that it's turned off for keyboards (which is what we want).
|
||||
// We prefer this method over XAutoRepeatOff/On, because the latter needs to
|
||||
@ -212,24 +197,14 @@ namespace OpenTK.Platform.X11
|
||||
|
||||
#region --- IInputDriver Members ---
|
||||
|
||||
#region public IList<Keyboard> Keyboard
|
||||
|
||||
public IList<KeyboardDevice> Keyboard
|
||||
{
|
||||
get { return dummy_keyboard_list; }//return keyboardDriver.Keyboard;
|
||||
public KeyboardDevice Keyboard {
|
||||
get { return keyboard; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public IList<Mouse> Mouse
|
||||
|
||||
public IList<MouseDevice> Mouse
|
||||
{
|
||||
get { return (IList<MouseDevice>)dummy_mice_list; } //return mouseDriver.Mouse;
|
||||
public MouseDevice Mouse {
|
||||
get { return mouse; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: Implement using native API, rather than through Mono.
|
||||
public Point DesktopCursorPos {
|
||||
get { return System.Windows.Forms.Cursor.Position; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user