diff src/video/x11/SDL_x11video.c @ 2763:6fc50bdd88c0

Some cleanups on the new XInput code. One or two things got moved around, but largely this is hooked up correctly in the Unix configure system now: it can be dynamically loaded and fallback gracefully if not available, or libXi can be directly linked to libSDL. XInput support can be --disable'd from the configure script, too (defaults to enabled). Please note that while the framework is in place to gracefully fallback, the current state of the source requires XInput. We'll need to adjust a few things still to correct this.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 17 Sep 2008 08:20:57 +0000
parents 44e49d3fa6cf
children 27cb878a278e
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Mon Sep 15 20:48:51 2008 +0000
+++ b/src/video/x11/SDL_x11video.c	Wed Sep 17 08:20:57 2008 +0000
@@ -28,13 +28,14 @@
 
 #include "SDL_x11video.h"
 
+#if SDL_VIDEO_DRIVER_X11_XINPUT
 XDevice **SDL_XDevices;
 int SDL_NumOfXDevices;
 XEventClass SDL_XEvents[256];
 int SDL_NumOfXEvents;
-
 int motion, button_pressed, button_released;    /* the definitions of the mice events */
 int proximity_in, proximity_out;
+#endif
 
 /* Initialization/Query functions */
 static int X11_VideoInit(_THIS);
@@ -248,6 +249,12 @@
     }
     X11_InitMouse(_this);
 
+    /* Set reasonable defaults, in case !SDL_VIDEO_DRIVER_X11_XINPUT */
+    motion = MotionNotify;
+    button_pressed = ButtonPress;
+    button_released = ButtonRelease;
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT
     /* we're generating the table of events that should be recognized */
     for (i = 0; i < SDL_NumOfXDevices; ++i) {
         /* button events */
@@ -283,6 +290,7 @@
 
     }
     SDL_NumOfXEvents = index;
+#endif
 
     return 0;
 }
@@ -306,7 +314,10 @@
     X11_QuitModes(_this);
     X11_QuitKeyboard(_this);
     X11_QuitMouse(_this);
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT
     free(SDL_XDevices);
+#endif
 }
 
 /* vim: set ts=4 sw=4 expandtab: */