Commit Graph

79 Commits

Author SHA1 Message Date
Camilla Löwy
782e6b6cef Make joystick platform code init on demand
This makes joystick support initialize the first time a joystick
function is called, including those gamepad functions that are layered
on top of joystick functions.

Related to #1284.
Related to #1646.
2020-07-21 17:38:56 +02:00
Luflosi
74a46dfa0c Use the correct type in a for loop
The `sizeof()` operator has the type `size_t`, so the `for` loop
iterating over it should use the same type.

Closes #1614.
2019-12-26 16:31:37 +01:00
Camilla Löwy
56aad76b16 Add C dialect reminders to each source file
Files built for Win32 must use C89 style declarations for compatibility
with VS 2010 and 2012, which are still supported by GLFW.
2019-05-24 14:43:49 +02:00
Camilla Löwy
a337c56848 Start 3.4 2019-04-16 23:08:39 +02:00
Camilla Löwy
ab118b2529 Fix copyright years (somewhat) 2019-04-15 20:50:00 +02:00
Camilla Löwy
0d355379e0 Cocoa: Support some sim page joystick elements
This is an SDL2 compatibility fix.
2019-03-28 22:58:47 +01:00
Camilla Löwy
c20754c4a6 Fix Coverity Scan false positive 2019-03-04 18:52:56 +01:00
Camilla Löwy
90e22947c6 Cleanup 2019-01-31 01:58:04 +01:00
Camilla Löwy
463ef7eb71 Cocoa: Fix handling of analog joystick buttons
The reported state was not clamped to [0,1], i.e. GLFW_RELEASE and
GLFW_PRESS.

Fixes #1385.
2019-01-31 01:54:49 +01:00
Camilla Löwy
51ca41dd9f Cocoa: Add missing IOHID page and usages
Related to #1385.
2019-01-31 01:53:55 +01:00
Stephen Gowen
bb13275b72 Cocoa: Fix Xcode Warnings
Closes #1132.
2017-11-20 18:04:05 +01:00
Camilla Löwy
e3be6b8ae0 Cleanup
Break up some overly long lines.
2017-09-17 15:14:22 +02:00
Camilla Löwy
ea6c50d9e2 Cleanup 2017-07-10 12:53:20 +02:00
Camilla Löwy
617c42b20a Cleanup 2017-07-09 14:01:48 +02:00
Camilla Löwy
953106e74d Add support for SDL_GameControllerDB
This adds support for importing and applying mappings from the
SDL_GameControllerDB database.

Related to #900.
2017-07-07 15:52:33 +02:00
Camilla Löwy
cf2eab5b4e Cocoa: Made axis auto-calibration less jumpy 2017-03-23 17:33:05 +01:00
Camilla Löwy
55d0560746 Cocoa: Fix range handling for hats and buttons
Fixes #888.
2017-03-23 15:58:14 +01:00
Camilla Löwy
798d7c6d68 Implement glfwGetJoystickHats
This moves the buttons-as-hats logic to shared code and adds the
GLFW_JOYSTICK_HAT_BUTTONS input mode as a way to disable this legacy
behavior.

Fixes #889.
2017-03-06 03:23:29 +01:00
Camilla Löwy
9950d8a319 Cleanup 2017-02-26 22:18:47 +01:00
Camilla Löwy
bfd564f257 Move internals to shared joystick objects
Preparation for gamecontrollerdb support and the gamepad API.
2017-01-30 16:52:49 +01:00
Camilla Löwy
e7722af9a2 Cleanup 2017-01-12 05:30:56 +01:00
Camilla Löwy
f4d0c83181 Paperwork done 2016-11-30 14:00:41 +01:00
Camilla Berglund
efc6b35615 Rename joystick ID variables 2016-10-16 14:07:18 +02:00
Camilla Berglund
53fafad915 Start 3.3 2016-08-18 23:55:49 +02:00
Camilla Berglund
76801973e1 Cocoa: Clean up joystick globals 2016-06-15 01:35:07 +02:00
Camilla Berglund
757eea2779 Update email address 2016-06-01 21:25:20 +02:00
Camilla Berglund
6a8e169001 Update copyright notice year 2016-06-01 21:25:19 +02:00
IntellectualKitty
3b0b5dacf5 Fix test for joystick presence in matchCallback
The matchCallback function has an initial loop to filter out redundant
joystick additions based on matching deviceRef values.  However, the if
statement incorrectly combines this test with the condition that the
joystick is not present, which is obviously incorrect.

Closes #753.
2016-04-27 15:42:19 +02:00
Camilla Berglund
3aebb0bfe3 Cleanup 2016-03-31 12:23:49 +02:00
Camilla Berglund
8a7fa306ce Add glfwSetJoystickCallback 2016-03-31 12:12:09 +02:00
Camilla Berglund
c580949417 Cleanup 2016-03-29 14:01:06 +02:00
IntellectualKitty
ae4ece840d Remove redundant OS X joystick polling
Closes #729.
2016-03-29 14:00:13 +02:00
Aaron Jacobs
49d228207f Fix crash when joystick name unavailable on OS X
Fixes #694.
Closes #701.
2016-02-09 07:52:00 +01:00
Camilla Berglund
12871db0f9 Only poll requested joystick on OS X 2015-12-13 15:15:50 +01:00
Camilla Berglund
7fec7a0569 Make source file names more consistent
Use platform prefix for files specific to that platform AND that have no
credible alternative API on that platform.

The exception is WinMM, which will be replaced before 3.2.
2015-12-13 14:51:44 +01:00
Camilla Berglund
660034332d Separated joystick state from window system state.
This is partially in preparation for pending support for additional
joystick APIs like XInput, DirectInput and IOHID.
2014-04-08 16:07:21 +02:00
Shane Liesegang
b4c03b992c Fixing memory leak in cocoa_joystick
Making sure that propsRef and valueRef get released no matter when we
break out of the loop.

Resolves #231.
2014-02-06 23:18:43 +01:00
Camilla Berglund
611006af18 Updated API version in comment headers. 2014-01-22 01:32:00 +01:00
Camilla Berglund
b13c84f854 Removed joystick axis value negation on OS X. 2013-11-07 20:45:29 +01:00
Camilla Berglund
4013f733fe Reverted change of IOKit functions.
The previously used set of functions caused a regression where no axes
or buttons were reported.  Fixes #78.
2013-11-07 20:19:30 +01:00
Camilla Berglund
3cfc400cf9 Simplified source file comment headers. 2013-07-30 14:46:52 +02:00
Camilla Berglund
7a03ca8dbc Removed superflous casts of allocated memory. 2013-07-04 14:54:07 +02:00
Camilla Berglund
209a470a5f Replaced all uses of malloc with calloc. 2013-07-04 14:20:14 +02:00
Camilla Berglund
180a4ee640 Fixed constness of joystick data. 2013-06-04 18:20:38 +02:00
Camilla Berglund
7f2eb7b15b New joystick API. 2013-05-22 21:56:14 +02:00
Camilla Berglund
58ae11778a Replaced expensive IOKit function. 2013-05-02 18:02:52 +02:00
Camilla Berglund
1ffd8f667f Cleanup. 2013-04-16 23:33:35 +02:00
Camilla Berglund
ec8273f249 Moved Cocoa joystick state to library struct. 2013-02-14 19:07:17 +01:00
Camilla Berglund
d97dddc8c4 Simplified function comment headers. 2013-02-11 19:43:22 +01:00
Camilla Berglund
3e78570a31 Removed duplicate documentation.
The public, platform, native, event and utility functions are already
documented in-source.  Having duplicate documentation inevitably means
having them contradict one another.  Furthermore, most of the function
descriptions simply repeated the name of the function.
2013-01-25 01:25:40 +01:00