diff src/video/x11/SDL_x11events.c @ 3003:699d68ef2aca

Fixed mouse events with --disable-video-x11-xinput
author Sam Lantinga <slouken@libsdl.org>
date Mon, 05 Jan 2009 07:04:54 +0000
parents e4f025078c1c
children 8f4ed5ec2b06
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Mon Jan 05 06:35:16 2009 +0000
+++ b/src/video/x11/SDL_x11events.c	Mon Jan 05 07:04:54 2009 +0000
@@ -281,14 +281,14 @@
         break;
 
     default:{
-#if SDL_VIDEO_DRIVER_X11_XINPUT
             for (i = 0; i < SDL_GetNumMice(); ++i) {
                 SDL_Mouse *mouse;
+#if SDL_VIDEO_DRIVER_X11_XINPUT
                 X11_MouseData *data;
+#endif
 
                 mouse = SDL_GetMouse(i);
-                data = (X11_MouseData *) mouse->driverdata;
-                if (!data) {
+                if (!mouse->driverdata) {
                     switch (xevent.type) {
                     case MotionNotify:
 #ifdef DEBUG_MOTION
@@ -312,7 +312,9 @@
                     continue;
                 }
 
-                if (xevent.type == data->motion) {      /* MotionNotify */
+#if SDL_VIDEO_DRIVER_X11_XINPUT
+                data = (X11_MouseData *) mouse->driverdata;
+                if (xevent.type == data->motion) {
                     XDeviceMotionEvent *move =
                         (XDeviceMotionEvent *) & xevent;
 #ifdef DEBUG_MOTION
@@ -322,14 +324,14 @@
                                         move->axis_data[2]);
                     return;
                 }
-                if (xevent.type == data->button_pressed) {      /* ButtonPress */
+                if (xevent.type == data->button_pressed) {
                     XDeviceButtonPressedEvent *pressed =
                         (XDeviceButtonPressedEvent *) & xevent;
                     SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
                                         pressed->button);
                     return;
                 }
-                if (xevent.type == data->button_released) {     /* ButtonRelease */
+                if (xevent.type == data->button_released) {
                     XDeviceButtonReleasedEvent *released =
                         (XDeviceButtonReleasedEvent *) & xevent;
                     SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
@@ -350,8 +352,8 @@
                                       proximity->y, SDL_PROXIMITYOUT);
                     return;
                 }
+#endif
             }
-#endif
 #ifdef DEBUG_XEVENTS
             printf("Unhandled event %d\n", xevent.type);
 #endif