comparison 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
comparison
equal deleted inserted replaced
2762:90de10bc38ec 2763:6fc50bdd88c0
26 #include "../SDL_sysvideo.h" 26 #include "../SDL_sysvideo.h"
27 #include "../SDL_pixels_c.h" 27 #include "../SDL_pixels_c.h"
28 28
29 #include "SDL_x11video.h" 29 #include "SDL_x11video.h"
30 30
31 #if SDL_VIDEO_DRIVER_X11_XINPUT
31 XDevice **SDL_XDevices; 32 XDevice **SDL_XDevices;
32 int SDL_NumOfXDevices; 33 int SDL_NumOfXDevices;
33 XEventClass SDL_XEvents[256]; 34 XEventClass SDL_XEvents[256];
34 int SDL_NumOfXEvents; 35 int SDL_NumOfXEvents;
35
36 int motion, button_pressed, button_released; /* the definitions of the mice events */ 36 int motion, button_pressed, button_released; /* the definitions of the mice events */
37 int proximity_in, proximity_out; 37 int proximity_in, proximity_out;
38 #endif
38 39
39 /* Initialization/Query functions */ 40 /* Initialization/Query functions */
40 static int X11_VideoInit(_THIS); 41 static int X11_VideoInit(_THIS);
41 static void X11_VideoQuit(_THIS); 42 static void X11_VideoQuit(_THIS);
42 43
246 if (X11_InitKeyboard(_this) != 0) { 247 if (X11_InitKeyboard(_this) != 0) {
247 return -1; 248 return -1;
248 } 249 }
249 X11_InitMouse(_this); 250 X11_InitMouse(_this);
250 251
252 /* Set reasonable defaults, in case !SDL_VIDEO_DRIVER_X11_XINPUT */
253 motion = MotionNotify;
254 button_pressed = ButtonPress;
255 button_released = ButtonRelease;
256
257 #if SDL_VIDEO_DRIVER_X11_XINPUT
251 /* we're generating the table of events that should be recognized */ 258 /* we're generating the table of events that should be recognized */
252 for (i = 0; i < SDL_NumOfXDevices; ++i) { 259 for (i = 0; i < SDL_NumOfXDevices; ++i) {
253 /* button events */ 260 /* button events */
254 DeviceButtonPress(SDL_XDevices[i], event_code, xEvent); 261 DeviceButtonPress(SDL_XDevices[i], event_code, xEvent);
255 if (xEvent) { 262 if (xEvent) {
281 motion = event_code; 288 motion = event_code;
282 } 289 }
283 290
284 } 291 }
285 SDL_NumOfXEvents = index; 292 SDL_NumOfXEvents = index;
293 #endif
286 294
287 return 0; 295 return 0;
288 } 296 }
289 297
290 void 298 void
304 data->dpms_enabled); 312 data->dpms_enabled);
305 313
306 X11_QuitModes(_this); 314 X11_QuitModes(_this);
307 X11_QuitKeyboard(_this); 315 X11_QuitKeyboard(_this);
308 X11_QuitMouse(_this); 316 X11_QuitMouse(_this);
317
318 #if SDL_VIDEO_DRIVER_X11_XINPUT
309 free(SDL_XDevices); 319 free(SDL_XDevices);
320 #endif
310 } 321 }
311 322
312 /* vim: set ts=4 sw=4 expandtab: */ 323 /* vim: set ts=4 sw=4 expandtab: */