Commit graph

3737 commits

Author SHA1 Message Date
Stefanos A
27e80fcc9e [Win] Completed WinRawJoystick implementation 2014-09-11 12:51:46 +02:00
Stefanos A
956691de31 [Win] Fixed RawHID struct definition 2014-09-11 12:51:46 +02:00
Stefanos A
94476b930e [Common] Moved axis translation to common 2014-09-11 12:51:46 +02:00
Stefanos A
85e6b9f9ad [Win] Wrapped additional HID APIs 2014-09-11 12:51:46 +02:00
Stefanos A
2c197f09e1 [Win] Cleanup Raw Input HID usage/pages 2014-09-11 12:51:46 +02:00
Stefanos A
cac96bbaf9 [Common] Cleaned up comments 2014-09-11 12:51:46 +02:00
Stefanos A
dc357604df [Win] Added HidProtocol binding 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
Stefanos A
18c02db7b0 [Win] Initial implementation of WinRawJoystick 2014-09-11 12:51:46 +02:00
Stefanos A
9cf3deea8c [Win] Improve WinMM.GetCapabilities performance
Polling joyGetCaps is very very slow, so we should not do that every
time GetCapabilities is called. Instead, we should call joyGetCaps once
and cache the results.

We need to find a different way to implement hotplugging.
2014-09-11 12:51:46 +02:00
Stefanos A
c3b289ee9b [Win] Implemented XInput vibration support 2014-09-11 12:51:46 +02:00
Stefanos A
06e63946cc [Win] Separate keyboard/mouse & joystick drivers
Keyboard/mouse support comes through WinRawInput; joystick support
through CombinedJoystickDriver. These drivers are now instantiated
separately.
2014-09-11 12:51:45 +02:00
Stefanos A
5cfde8ff0f [Win] Added combined XInput+WinMM joystick driver
Joystick devices will be queried through XInput first, with a fallback
to WinMM in case they are not recognized by the newer API.
2014-09-11 12:51:45 +02:00
Stefanos A
14d07a5952 [Win] Corrected XInput Guid in gamepad database
All XInput devices expose the same button layout, so they only need a
single entry in the gamepad configuration database.
2014-09-11 12:51:45 +02:00
Stefanos A
765ad9e05b [Win] WinRawInput is IKeyboard/MouseDriver2
Since we do not use Raw Input for joystick devices, it does not make
sense to expose the IJoystickDriver2 interface through WinRawInput. This
keeps allows joystick and keyboard/mouse implementations to reside in
distinct, modular classes, instantiated separately through WinFactory.
2014-09-11 12:51:45 +02:00
Stefanos A
8968f7ff38 [Win] XInputJoystick is now IJoystickDriver2
The IGamePadDriver interface is now implemented using
MappedGamePadDriver on all platforms. This minimizes code duplication
and simplifies all input driver implementations, since we only need
backends for IJoystickDriver2.
2014-09-11 12:51:45 +02:00
Stefanos A
0e72cb3dd2 [OpenTK] Removed unused CreateGraphicsMode API
IPlatformFactory.CreateGraphicsMode is no longer used or required.
2014-09-11 12:51:45 +02:00
thefiddler
d6d6842730 Merge pull request #178 from thefiddler/mac_crash
[Mac] Avoid crash when combining with MonoMac/Xamarin.Mac
2014-09-11 12:42:20 +02:00
thefiddler
6292ad4160 [Mac] Avoid calling finishLaunching multiple times 2014-09-11 12:21:05 +02:00
thefiddler
1080dec04d [Mac] Do not modify existing mainMenu
If an application already has a custom main menu, avoid overwriting
that in OpenTK.
2014-09-11 12:07:53 +02:00
thefiddler
c6989395df [Input] Added GameWindow.Mouse/Keyboard.GetState()
GameWindow.Mouse/Keyboard hide OpenTK.Input.Mouse/Keyboard.
To simplify usage, the former now provide the same methods
as the latter.
2014-09-11 01:03:24 +02:00
thefiddler
ffa3df29eb [X11] Fixed core X11 scrolling and absolute y motions 2014-08-10 02:56:37 +02:00
thefiddler
9ae778a00f [X11] Fixed absolute motion valuators 2014-08-09 22:09:32 +02:00
thefiddler
5a5607eaa5 [X11] Added strong-typed enum for XIValuatorInfo.mode 2014-08-09 22:09:16 +02:00
thefiddler
a3e47a2431 [X11] Check before using motion/scroll valuators
These valuators are not available on all systems. We now check
explicitly for support, instead of returning invalid results.

Additionally, unknown valuator names are now printed to the
debug log.
2014-08-09 21:47:09 +02:00
thefiddler
073ddf1bef [X11] Added XGetAtomName() function 2014-08-09 21:46:55 +02:00
thefiddler
5444c0c8b8 [SDL] Workaround for a Mono crash in SDL.JoystickGetGUID
It appears that Mono 3.4.0 fails to marshal SDL_JoystickGUID
correctly when used as a return value. Changing the fixed buffer
to a couple of long fields allows the struct to be marshalled
correctly.
2014-08-09 21:17:49 +02:00
thefiddler
e243316e8e [Input] Cleaned up line endings and joystick hat mapping 2014-07-29 23:21:37 +02:00
Andrew O'Connor
fe1d465b85 [Input][SDL] Fix JoystickHat bugs
On SDL, DPad inputs were not correctly translated from joystick
hat inputs.
Updated MappedGamePadDriver so that it will correctly recognize
combined joystick hat directions e.g. DPadLeft should be true when
DownLeft, Left, or UpLeft are returned from the joystick hat.
2014-07-27 14:54:36 +01:00
thefiddler
e5cd6a3b9e [Input] Implemented JoystickHat GamePad mapping 2014-07-25 23:26:03 +02:00
thefiddler
7c55e4e9ec [Input] Corrected invalid GUID in GamePad database 2014-07-24 01:10:22 +02:00
thefiddler
3e9b2005d1 [Input] Sync GamePad database with SDL 2.0.4 2014-07-24 00:19:41 +02:00
thefiddler
6db29562cc [Mac] Release input driver before other resources
The input driver relies on the existence of a CFRunLoop. Releasing it
first ensures that a CFRunLoop is available for its complete life cycle.
2014-07-23 23:23:14 +02:00
thefiddler
f799530575 [Mac] Do not use autorelease pool
Avoids a potential crash on shutdown.
2014-07-23 23:22:00 +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
15f87c15a1 [Graphics] Implemented structural equality
GraphicsContexts are now considered equal if they store the same
context handle. Debugging information is also improved.
2014-07-23 21:24:24 +02:00
thefiddler
29af70274d [Mac] Removed stored delegate list
The stored delegate list would store delegates indefinitely, causing a
memory leak. It is now the responsibility of each class to maintain
references to any callback functions it defines.
2014-07-23 21:23:25 +02:00
thefiddler
8f30f77b30 [OpenTK] Removed the finalizer in OpenTK.Toolkit
This resolves crashes related to the platform factory being reset while
resources are still live.
2014-07-23 21:22:22 +02:00
thefiddler
8b1be5c49a [OpenTK] Dispose() now clear the list of resources 2014-07-23 21:20:28 +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
d12643cf44 [Mac] Mark callback calling convention
Callbacks are now explicitly marked as unmanaged pointers with the
correct (platform-defined) calling convention. Exceptions raised inside
these callbacks are no longer allowed to escape into unmanaged code,
where they will crash the runtime.

Additionally, the window is now only closed on the UI thread, and only
if it is actually open.
2014-07-23 21:18:34 +02:00
thefiddler
a6c4a7c9b5 [Mac] Only dispose context on UI thread 2014-07-23 21:15:16 +02:00
thefiddler
e5e9ae0929 [Mac]] Add NSApplication.IsUIThread property
This can be used to check whether it is safe to access UI components in
the calling thread.
2014-07-23 21:14:47 +02:00
thefiddler
050a93d4af [Mac] Resource registration moved to the facades 2014-07-23 14:36:09 +02:00
thefiddler
ac2ae4a4bb [Mac] Ensure Cocoa bindings are initialized first 2014-07-23 14:35:51 +02:00
thefiddler
6abca6ddf7 [OpenTK] Register GraphicsContext and NativeWindow 2014-07-23 14:35:33 +02:00
thefiddler
ab75ca05c4 [OpenTK] Added IPlatformFactory.RegisterResource() 2014-07-23 14:34:52 +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
4093b39fac [Mac] Store a reference to callback delegates
This avoids a potential crashes by the GC reclaiming the delegates
prematurely.
2014-07-23 10:10:08 +02:00
thefiddler
e81d8da068 [OpenTK] Reduce duplication in GraphicsContextBase
Inheritors now take advantage of base class functionality to avoid
duplicating finalizers and warning messages.
2014-07-23 10:08:57 +02:00