1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

Fix X11 build on non-Linux systems

This commit is contained in:
Camilla Berglund 2016-05-04 16:56:17 +02:00
parent 12a695696d
commit 9d50a346f0
2 changed files with 10 additions and 6 deletions

View File

@ -45,9 +45,9 @@
// Attempt to open the specified joystick device
//
#if defined(__linux__)
static GLFWbool openJoystickDevice(const char* path)
{
#if defined(__linux__)
char axisCount, buttonCount;
char name[256];
int joy, fd, version;
@ -102,9 +102,9 @@ static GLFWbool openJoystickDevice(const char* path)
js->buttons = calloc(buttonCount, 1);
_glfwInputJoystickChange(joy, GLFW_CONNECTED);
#endif // __linux__
return GLFW_TRUE;
}
#endif // __linux__
// Polls for and processes events the specified joystick
//
@ -155,12 +155,14 @@ static GLFWbool pollJoystickEvents(_GLFWjoystickLinux* js)
// Lexically compare joysticks, used by quicksort
//
#if defined(__linux__)
static int compareJoysticks(const void* fp, const void* sp)
{
const _GLFWjoystickLinux* fj = fp;
const _GLFWjoystickLinux* sj = sp;
return strcmp(fj->path, sj->path);
}
#endif // __linux__
//////////////////////////////////////////////////////////////////////////
@ -274,6 +276,7 @@ void _glfwTerminateJoysticksLinux(void)
void _glfwPollJoystickEvents(void)
{
#if defined(__linux__)
ssize_t offset = 0;
char buffer[16384];
@ -293,6 +296,7 @@ void _glfwPollJoystickEvents(void)
offset += sizeof(struct inotify_event) + e->len;
}
#endif
}

View File

@ -57,16 +57,16 @@ void selectDisplayConnection(struct timeval* timeout)
int result, count;
const int fd = ConnectionNumber(_glfw.x11.display);
count = fd + 1;
FD_ZERO(&fds);
FD_SET(fd, &fds);
#if defined(__linux__)
FD_SET(_glfw.linux_js.inotify, &fds);
#endif
if (fd > _glfw.linux_js.inotify)
count = fd + 1;
else
if (fd < _glfw.linux_js.inotify)
count = _glfw.linux_js.inotify + 1;
#endif
// NOTE: We use select instead of an X function like XNextEvent, as the
// wait inside those are guarded by the mutex protecting the display