Commit graph

60 commits

Author SHA1 Message Date
thefiddler 383cea7e82 [Mac] Fixed exception in HIDInput.Dispose()
HIDInput.Dispose() would remove elements from a DeviceCollection during
iteration. This results in an exception.

We are now using a plain for-loop instead.
2014-09-20 17:11:18 +02:00
thefiddler 8642177c30 [Mac] Use DeviceCollection
This reduces code duplication significantly.
2014-09-18 01:16:41 +02:00
thefiddler 2a6579032e [Mac] Match SDL2 element order
Joystick elements (axes, buttons, hats) are now reported in the same
order as SDL2. This fixes potential mismatches in the GamePad
configuration database.

Additionally, elements are now counted correctly (duplicate elements no
longer count towards the total.)
2014-09-18 01:16:40 +02:00
thefiddler fbedac9a16 [Mac] Fixed Joystick Hat calculations 2014-09-18 01:16:40 +02:00
thefiddler b9f7f2c242 [Mac] Sort joystick elements like SDL2
GamePad configuration database is now working correctly on Mac.
2014-09-18 01:16:40 +02:00
thefiddler 4231cf2cdd [Mac] Use cookies to match HID joystick elements 2014-09-18 01:16:40 +02:00
thefiddler d4c6b2e699 [Mac] Fixed joystick Guid calculation
The result now matches the output of SDL2 as well as the entries in the
GamePad configuration database.
2014-09-18 01:16:40 +02:00
Stefanos A 94476b930e [Common] Moved axis translation to common 2014-09-11 12:51:46 +02:00
Stefanos A 178305e1c1 [Common] Added HID usage page definitions 2014-09-11 12:51:46 +02:00
thefiddler bb882fe700 [Mac] Correctly release mach port
The event tap is released automatically along with the mach port. Fixes
crash on shutdown.
2014-07-23 23:21:04 +02:00
thefiddler 57c2f89038 [Mac] Explicitly close removed devices
Devices are now explicitly closed when they a DeviceRemoved event is
received. Additionally, exceptions are no longer allowed to escape into
unmanaged code, where they might crash the runtime.
2014-07-23 21:19:46 +02:00
thefiddler 5d66aaa034 [Mac] Do not set callback delegates to null
This is done automatically by the GC once they are eligible for
collection.
2014-07-23 10:10:37 +02:00
thefiddler 864cc84019 [Mac] Do not execute run loop prematurely
Fixes a potential crash when destroying and recreating OpenTK.Toolkit.
2014-07-23 09:20:51 +02:00
thefiddler 7956126c8d [Mac] Retain CFRunLoop while it is in use 2014-07-22 16:20:46 +02:00
thefiddler a047c08d3d [Mac] Correctly shutdown HID input driver 2014-07-22 14:28:48 +02:00
thefiddler 00b531fdef Fixed compilation warnings on Mono 3.4.0 2014-07-21 17:46:39 +02:00
thefiddler 8373782fad [Mac] Fix Mouse.GetState() h-wheel
External mice will now report horizontal scrolling in the low-level
`Mouse.GetState()` API. The touchpad apparently creates an emulated
mouse device that does not report horizontal wheel scrolling events.

Touchpad support probably requires a proper multitouch implementation.
2014-06-10 17:43:31 +02:00
thefiddler 2a4f634848 [Mac] Match win32 scrolling coordinates 2014-06-10 16:40:44 +02:00
thefiddler 96aaef9b37 [Mac] Implemented Mouse.GetCursorState() 2014-05-12 02:20:53 +02:00
thefiddler f4a3cab0e0 [Input] Added Mouse.GetCursorPos() (WIP) 2014-05-12 02:20:52 +02:00
thefiddler d968281a1b [OpenTK] Refactor keyboard and mouse handling
A lot of duplicated code is now moved to NativeWindowBase and
LegacyInputDriver.
2014-05-04 17:05:08 +02:00
thefiddler 94fdf1881c [Platform] Improved mouse interface
- The complete mouse state is now available in mouse events
- Horizontal wheels are now supported
- MouseState now takes up less memory and has a simpler internal
implementation.
2014-05-04 01:29:55 +02:00
thefiddler 5145ebceb7 [Mac] Implemented JoystickHat support 2014-01-31 16:17:04 +01:00
thefiddler a7228274aa [Input] Added JoystickCapabilities.HatCount 2014-01-31 15:40:07 +01:00
thefiddler a9ab3650da [Mac] Do not store *State structs directly
Storing Mouse/KeyboardState structs directly makes updates more
difficult than they should be. It is simpler to create simple classes
instead.
2014-01-05 23:58:05 +01:00
thefiddler fda2d32d2d [Mac] Map GamePads, MultiAxisControllers and Wheels to joysticks 2014-01-05 22:44:58 +01:00
thefiddler a1123834a0 [Mac] Call DeviceRemoved() in Dispose() event
The necessary cleanup code already exists in DeviceRemoved(). No need
to duplicate this in the Dispose() event.
2014-01-05 22:38:26 +01:00
thefiddler ab85afd5ba [Mac] Avoid IOHIDDeviceConformsTo call in DeviceRemoved handler
DeviceAdded already checks that devices conform to the desired usage
pages. Checking again in DeviceRemoved is unnecessary - if a device
exists, then it has already passed muster.
2014-01-05 22:36:01 +01:00
thefiddler 9e223486f6 [Mac] Implement Joystick.GetGuid() 2014-01-05 22:15:55 +01:00
thefiddler 5c5afb3ea3 [Mac] Calculate joystick Guid for USB devices 2014-01-05 22:06:19 +01:00
thefiddler fa386dc991 [Mac] Connect devices to first available index 2014-01-05 21:53:28 +01:00
thefiddler 05af21e61b [Mac] Do not call CFRelease on HID properties
HID properties are callee-owned and should not be released by the
caller. Fixes crash (memory corruption) on device hot plugging.
2014-01-05 21:27:34 +01:00
thefiddler 02c9f471ea [Mac] DllImport must be marked as extern 2014-01-05 21:18:20 +01:00
thefiddler 7388bd935d [Mac] Correctly unschedule HIDManager from run loop 2014-01-05 20:17:03 +01:00
thefiddler 4c7f6a92a7 [Mac] Don't let exceptions escape to unmanaged code 2014-01-05 04:20:51 +01:00
thefiddler 892d129e54 [Mac] Fixed DllEntryPointNotFound crash on device unplugging 2014-01-05 04:15:30 +01:00
thefiddler 2ee24efb2f [Mac] Implemented joystick buttons 2014-01-05 04:11:11 +01:00
thefiddler fad42994e1 [Mac] Implemented joystick axis movement 2014-01-05 03:54:53 +01:00
thefiddler 59249c2624 [Mac] Implemented joystick device detection 2014-01-05 03:03:46 +01:00
thefiddler 07bcda0f57 [Mac] Retrieve HID joystick name 2014-01-05 02:42:47 +01:00
thefiddler 32653d2c64 [Mac] Construct JoystickDevice when joysticks are connected 2014-01-05 00:47:40 +01:00
thefiddler bf8efea121 [Mac] Only add callbacks for recognized USB HID devices 2014-01-05 00:00:49 +01:00
thefiddler c44b477388 [Mac] Implement device added/removed events for joysticks 2014-01-04 23:58:59 +01:00
thefiddler 9659a1d786 [Mac] Add skeleton HID input implementation for joysticks 2014-01-04 23:55:38 +01:00
thefiddler b9a8e365de [Input] Added IJoystickDriver2.GetGuid() API 2013-12-31 14:09:17 +01:00
thefiddler 1eb807bb64 Use IGamePadDriver through MappedGamePadDriver 2013-12-24 17:18:05 +01:00
Stefanos A 7e5307bd4a Added IJoystickDevice2 interface 2013-12-24 17:18:03 +01:00
thefiddler 8f7eebb58d Enabled HIDInput IGamePadDriver implementation 2013-12-24 17:18:02 +01:00
Stefanos A a85cecdc59 Improved resource disposal
Added IDisposable interface to all classes holding native data that must be freed. OpenTK.Toolkit.Init() now returns an IDisposable instance that can be used to cleanup all native data held by OpenTK. This is useful when re-initializing OpenTK (possibly in a new AppDomain), as is the case in the Example browser.
2013-10-01 22:01:27 +02:00
Andy Korth 0f64af130a Committing artfunkel patch for scan codes 2013-01-24 15:48:01 -06:00