src/video/x11/SDL_x11mouse.c
changeset 2763 6fc50bdd88c0
parent 2710 44e49d3fa6cf
child 2765 f55c87ae336b
     1.1 --- a/src/video/x11/SDL_x11mouse.c	Mon Sep 15 20:48:51 2008 +0000
     1.2 +++ b/src/video/x11/SDL_x11mouse.c	Wed Sep 17 08:20:57 2008 +0000
     1.3 @@ -20,22 +20,25 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  #include "SDL_config.h"
     1.7 -
     1.8  #include "SDL_x11video.h"
     1.9 -
    1.10  #include "../../events/SDL_mouse_c.h"
    1.11  
    1.12  void
    1.13  X11_InitMouse(_THIS)
    1.14  {
    1.15 -    extern XDevice **SDL_XDevices;
    1.16 +#if SDL_VIDEO_DRIVER_X11_XINPUT
    1.17      XDevice **newDevices;
    1.18      int i, j, index = 0, numOfDevices;
    1.19 -    extern int SDL_NumOfXDevices;
    1.20      XDeviceInfo *DevList;
    1.21      XAnyClassPtr deviceClass;
    1.22      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    1.23  
    1.24 +    SDL_XDevices = NULL;
    1.25 +    SDL_NumOfXDevices = 0;
    1.26 +
    1.27 +    if (!SDL_X11_HAVE_XINPUT)
    1.28 +        return;  /* should have dynamically loaded, but wasn't available. */
    1.29 +
    1.30      /* we're getting the list of input devices */
    1.31      DevList = XListInputDevices(data->display, &numOfDevices);
    1.32      SDL_XDevices = (XDevice **) SDL_malloc(sizeof(XDevice));
    1.33 @@ -92,6 +95,7 @@
    1.34      XFreeDeviceList(DevList);
    1.35  
    1.36      SDL_NumOfXDevices = index;
    1.37 +#endif
    1.38  }
    1.39  
    1.40  void
    1.41 @@ -99,6 +103,8 @@
    1.42  {
    1.43      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    1.44  
    1.45 +    /* !!! FIXME: use XCloseDevice()? Or maybe handle under SDL_MouseQuit()? */
    1.46 +
    1.47      /* let's delete all of the mice */
    1.48      SDL_MouseQuit();
    1.49  }