comparison src/video/x11/SDL_x11mouse.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 f55c87ae336b
comparison
equal deleted inserted replaced
2762:90de10bc38ec 2763:6fc50bdd88c0
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23
24 #include "SDL_x11video.h" 23 #include "SDL_x11video.h"
25
26 #include "../../events/SDL_mouse_c.h" 24 #include "../../events/SDL_mouse_c.h"
27 25
28 void 26 void
29 X11_InitMouse(_THIS) 27 X11_InitMouse(_THIS)
30 { 28 {
31 extern XDevice **SDL_XDevices; 29 #if SDL_VIDEO_DRIVER_X11_XINPUT
32 XDevice **newDevices; 30 XDevice **newDevices;
33 int i, j, index = 0, numOfDevices; 31 int i, j, index = 0, numOfDevices;
34 extern int SDL_NumOfXDevices;
35 XDeviceInfo *DevList; 32 XDeviceInfo *DevList;
36 XAnyClassPtr deviceClass; 33 XAnyClassPtr deviceClass;
37 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 34 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
35
36 SDL_XDevices = NULL;
37 SDL_NumOfXDevices = 0;
38
39 if (!SDL_X11_HAVE_XINPUT)
40 return; /* should have dynamically loaded, but wasn't available. */
38 41
39 /* we're getting the list of input devices */ 42 /* we're getting the list of input devices */
40 DevList = XListInputDevices(data->display, &numOfDevices); 43 DevList = XListInputDevices(data->display, &numOfDevices);
41 SDL_XDevices = (XDevice **) SDL_malloc(sizeof(XDevice)); 44 SDL_XDevices = (XDevice **) SDL_malloc(sizeof(XDevice));
42 45
90 } 93 }
91 } 94 }
92 XFreeDeviceList(DevList); 95 XFreeDeviceList(DevList);
93 96
94 SDL_NumOfXDevices = index; 97 SDL_NumOfXDevices = index;
98 #endif
95 } 99 }
96 100
97 void 101 void
98 X11_QuitMouse(_THIS) 102 X11_QuitMouse(_THIS)
99 { 103 {
100 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 104 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
101 105
106 /* !!! FIXME: use XCloseDevice()? Or maybe handle under SDL_MouseQuit()? */
107
102 /* let's delete all of the mice */ 108 /* let's delete all of the mice */
103 SDL_MouseQuit(); 109 SDL_MouseQuit();
104 } 110 }
105 111
106 /* vi: set ts=4 sw=4 expandtab: */ 112 /* vi: set ts=4 sw=4 expandtab: */