aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-06-23 16:21:55 +0000
committerBrian Paul <[email protected]>2000-06-23 16:21:55 +0000
commit4ec13a48b186c92c293fce8d7f6e071b8586dba8 (patch)
tree0921e28914ed70fe4d9d93ef59f7a37228904d50 /src
parent3c8299c77967611db138169c56a7c6a1c0086d1c (diff)
applied joystick patch from Michael Champigny
Diffstat (limited to 'src')
-rw-r--r--src/glut/glx/glut_input.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/glut/glx/glut_input.c b/src/glut/glx/glut_input.c
index eea96349eaf..007883d6b6e 100644
--- a/src/glut/glx/glut_input.c
+++ b/src/glut/glx/glut_input.c
@@ -159,7 +159,7 @@ tabletPosChange(GLUTwindow * window, int first, int count, int *data)
}
#endif /* !_WIN32 */
-int
+static int
__glutProcessDeviceEvents(XEvent * event)
{
#if !defined(_WIN32)
@@ -264,18 +264,17 @@ __glutProcessDeviceEvents(XEvent * event)
#else
{
JOYINFOEX info;
- int njoyId = 0;
- int nConnected = 0;
- MMRESULT result;
-
- /* Loop through all possible joystick IDs until we get the error
- JOYERR_PARMS. Count the number of times we get JOYERR_NOERROR
- indicating an installed joystick driver with a joystick currently
- attached to the port. */
- while ((result = joyGetPosEx(njoyId++,&info)) != JOYERR_PARMS) {
- if (result == JOYERR_NOERROR) {
- ++nConnected; /* The count of connected joysticks. */
- }
+ JOYCAPS joyCaps;
+
+ if (joyGetPosEx(JOYSTICKID1,&info) != JOYERR_NOERROR) {
+ __glutHasJoystick = 1;
+ joyGetDevCaps(JOYSTICKID1, &joyCaps, sizeof(joyCaps));
+ __glutNumJoystickButtons = joyCaps.wNumButtons;
+ __glutNumJoystickAxes = joyCaps.wNumAxes;
+ } else {
+ __glutHasJoystick = 0;
+ __glutNumJoystickButtons = 0;
+ __glutNumJoystickAxes = 0;
}
}
#endif /* !_WIN32 */