Fixed mouse events with --disable-video-x11-xinput
authorSam Lantinga <slouken@libsdl.org>
Mon, 05 Jan 2009 07:04:54 +0000
changeset 3003699d68ef2aca
parent 3002 0deb3e94c251
child 3004 f3d7226a8dfd
Fixed mouse events with --disable-video-x11-xinput
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Mon Jan 05 06:35:16 2009 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Mon Jan 05 07:04:54 2009 +0000
     1.3 @@ -281,14 +281,14 @@
     1.4          break;
     1.5  
     1.6      default:{
     1.7 -#if SDL_VIDEO_DRIVER_X11_XINPUT
     1.8              for (i = 0; i < SDL_GetNumMice(); ++i) {
     1.9                  SDL_Mouse *mouse;
    1.10 +#if SDL_VIDEO_DRIVER_X11_XINPUT
    1.11                  X11_MouseData *data;
    1.12 +#endif
    1.13  
    1.14                  mouse = SDL_GetMouse(i);
    1.15 -                data = (X11_MouseData *) mouse->driverdata;
    1.16 -                if (!data) {
    1.17 +                if (!mouse->driverdata) {
    1.18                      switch (xevent.type) {
    1.19                      case MotionNotify:
    1.20  #ifdef DEBUG_MOTION
    1.21 @@ -312,7 +312,9 @@
    1.22                      continue;
    1.23                  }
    1.24  
    1.25 -                if (xevent.type == data->motion) {      /* MotionNotify */
    1.26 +#if SDL_VIDEO_DRIVER_X11_XINPUT
    1.27 +                data = (X11_MouseData *) mouse->driverdata;
    1.28 +                if (xevent.type == data->motion) {
    1.29                      XDeviceMotionEvent *move =
    1.30                          (XDeviceMotionEvent *) & xevent;
    1.31  #ifdef DEBUG_MOTION
    1.32 @@ -322,14 +324,14 @@
    1.33                                          move->axis_data[2]);
    1.34                      return;
    1.35                  }
    1.36 -                if (xevent.type == data->button_pressed) {      /* ButtonPress */
    1.37 +                if (xevent.type == data->button_pressed) {
    1.38                      XDeviceButtonPressedEvent *pressed =
    1.39                          (XDeviceButtonPressedEvent *) & xevent;
    1.40                      SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
    1.41                                          pressed->button);
    1.42                      return;
    1.43                  }
    1.44 -                if (xevent.type == data->button_released) {     /* ButtonRelease */
    1.45 +                if (xevent.type == data->button_released) {
    1.46                      XDeviceButtonReleasedEvent *released =
    1.47                          (XDeviceButtonReleasedEvent *) & xevent;
    1.48                      SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
    1.49 @@ -350,8 +352,8 @@
    1.50                                        proximity->y, SDL_PROXIMITYOUT);
    1.51                      return;
    1.52                  }
    1.53 +#endif
    1.54              }
    1.55 -#endif
    1.56  #ifdef DEBUG_XEVENTS
    1.57              printf("Unhandled event %d\n", xevent.type);
    1.58  #endif