Fixing bug 3048705 -- "fgOpenWindow should only return after the window opens". ...
[freeglut] / src / freeglut_input_devices.c
index 1734a42..04f5fd5 100755 (executable)
 #include "freeglut_internal.h"
 
 #if TARGET_HOST_POSIX_X11
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
+#endif
 #include <sys/ioctl.h>
-#include <sys/time.h>
-#include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <termios.h>
 #include <fcntl.h>
-#include <sys/types.h>
 
 typedef struct {
    int fd;
@@ -136,9 +134,9 @@ int fgInputDeviceDetect( void )
  */
 void fgInitialiseInputDevices ( void )
 {
-    const char *dial_device=NULL;
     if( !fgState.InputDevsInitialised )
     {
+        const char *dial_device=NULL;
         dial_device = getenv ( "GLUT_DIALS_SERIAL" );
 #if TARGET_HOST_MS_WINDOWS
         if (!dial_device){