Commit b56953f4 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

dinput: Changed select to poll.

parent 0082973d
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
#ifdef HAVE_LINUX_JOYSTICK_H #ifdef HAVE_LINUX_JOYSTICK_H
# include <linux/joystick.h> # include <linux/joystick.h>
#endif #endif
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#endif
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -897,8 +900,7 @@ static LONG calculate_pov(JoystickImpl *This, int index) ...@@ -897,8 +900,7 @@ static LONG calculate_pov(JoystickImpl *This, int index)
} }
static void joy_polldev(JoystickImpl *This) { static void joy_polldev(JoystickImpl *This) {
struct timeval tv; struct pollfd plfd;
fd_set readfds;
struct js_event jse; struct js_event jse;
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -907,9 +909,9 @@ static void joy_polldev(JoystickImpl *This) { ...@@ -907,9 +909,9 @@ static void joy_polldev(JoystickImpl *This) {
return; return;
} }
while (1) { while (1) {
memset(&tv,0,sizeof(tv)); plfd.fd = This->joyfd;
FD_ZERO(&readfds);FD_SET(This->joyfd,&readfds); plfd.events = POLLIN;
if (1>select(This->joyfd+1,&readfds,NULL,NULL,&tv)) if (poll(&plfd,1,0) != 1)
return; return;
/* we have one event, so we can read */ /* we have one event, so we can read */
if (sizeof(jse)!=read(This->joyfd,&jse,sizeof(jse))) { if (sizeof(jse)!=read(This->joyfd,&jse,sizeof(jse))) {
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
# define HAVE_CORRECT_LINUXINPUT_H # define HAVE_CORRECT_LINUXINPUT_H
# endif # endif
#endif #endif
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#endif
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -860,8 +863,7 @@ static void calculate_ids(LPDIDATAFORMAT df) ...@@ -860,8 +863,7 @@ static void calculate_ids(LPDIDATAFORMAT df)
} }
static void joy_polldev(JoystickImpl *This) { static void joy_polldev(JoystickImpl *This) {
struct timeval tv; struct pollfd plfd;
fd_set readfds;
struct input_event ie; struct input_event ie;
int btn, offset; int btn, offset;
...@@ -869,11 +871,10 @@ static void joy_polldev(JoystickImpl *This) { ...@@ -869,11 +871,10 @@ static void joy_polldev(JoystickImpl *This) {
return; return;
while (1) { while (1) {
memset(&tv,0,sizeof(tv)); plfd.fd = This->joyfd;
FD_ZERO(&readfds); plfd.events = POLLIN;
FD_SET(This->joyfd,&readfds);
if (1>select(This->joyfd+1,&readfds,NULL,NULL,&tv)) if (poll(&plfd,1,0) != 1)
return; return;
/* we have one event, so we can read */ /* we have one event, so we can read */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment