• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //========================================================================
2 // GLFW 3.2 Linux - www.glfw.org
3 //------------------------------------------------------------------------
4 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
5 //
6 // This software is provided 'as-is', without any express or implied
7 // warranty. In no event will the authors be held liable for any damages
8 // arising from the use of this software.
9 //
10 // Permission is granted to anyone to use this software for any purpose,
11 // including commercial applications, and to alter it and redistribute it
12 // freely, subject to the following restrictions:
13 //
14 // 1. The origin of this software must not be misrepresented; you must not
15 //    claim that you wrote the original software. If you use this software
16 //    in a product, an acknowledgment in the product documentation would
17 //    be appreciated but is not required.
18 //
19 // 2. Altered source versions must be plainly marked as such, and must not
20 //    be misrepresented as being the original software.
21 //
22 // 3. This notice may not be removed or altered from any source
23 //    distribution.
24 //
25 //========================================================================
26 
27 #ifndef _glfw3_linux_joystick_h_
28 #define _glfw3_linux_joystick_h_
29 
30 #include <regex.h>
31 
32 #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWjoylistLinux linux_js
33 
34 
35 // Linux-specific joystick data
36 //
37 typedef struct _GLFWjoystickLinux
38 {
39     GLFWbool        present;
40     int             fd;
41     float*          axes;
42     int             axisCount;
43     unsigned char*  buttons;
44     int             buttonCount;
45     char*           name;
46     char*           path;
47 } _GLFWjoystickLinux;
48 
49 // Linux-specific joystick API data
50 //
51 typedef struct _GLFWjoylistLinux
52 {
53     _GLFWjoystickLinux js[GLFW_JOYSTICK_LAST + 1];
54 
55 #if defined(__linux__)
56     int             inotify;
57     int             watch;
58     regex_t         regex;
59 #endif /*__linux__*/
60 } _GLFWjoylistLinux;
61 
62 
63 GLFWbool _glfwInitJoysticksLinux(void);
64 void _glfwTerminateJoysticksLinux(void);
65 
66 void _glfwPollJoystickEvents(void);
67 
68 #endif // _glfw3_linux_joystick_h_
69