Search
lxdream.org :: lxdream :: r621:225d147d2b43
lxdream 0.9.1
released Jun 29
Download Now
changeset621:225d147d2b43
parent620:d9b28f78b952
child622:3554650afb26
authornkeynes
dateWed Jan 30 21:36:58 2008 +0000 (11 years ago)
Tidy up watch flag handling
src/drivers/joy_linux.c
1.1 --- a/src/drivers/joy_linux.c Wed Jan 30 11:31:21 2008 +0000
1.2 +++ b/src/drivers/joy_linux.c Wed Jan 30 21:36:58 2008 +0000
1.3 @@ -240,23 +240,24 @@
1.4
1.5 /*************************** dnotify support **********************/
1.6
1.7 -static volatile gboolean need_input_rescan = FALSE;
1.8 +static volatile int need_input_rescan = 0;
1.9 static int watch_dir_fd;
1.10
1.11 static gboolean gtk_loop_check_input(gpointer data)
1.12 {
1.13 - if( need_input_rescan ) {
1.14 + if( need_input_rescan == 1 ) {
1.15 + need_input_rescan = 0;
1.16 int js = linux_joystick_scan();
1.17 if( js > 0 ) {
1.18 maple_reattach_all();
1.19 }
1.20 }
1.21 - return TRUE;
1.22 + return need_input_rescan != 2;
1.23 }
1.24
1.25 static void dnotify_handler(int sig )
1.26 {
1.27 - need_input_rescan = TRUE;
1.28 + need_input_rescan = 1;
1.29 }
1.30
1.31 static gboolean linux_joystick_install_watch( const gchar *dir )
1.32 @@ -280,4 +281,5 @@
1.33 {
1.34 signal( SIGRTMIN+1, SIG_IGN );
1.35 close( watch_dir_fd );
1.36 + need_input_rescan = 2;
1.37 }
.