diff src/video/x11/SDL_x11events.c @ 2992:dbff5769d742

The core pointer is comprised of merging the inputs of all mice. If there are other mice, they should show up in the device list, and we want to report events from those devices instead of the core events. However, if XInput isn't supported or we can't find other mice in the device list, we'll add the core pointer and interpret normal mouse events.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Jan 2009 18:29:20 +0000
parents 1e431c2631ee
children 2fad80c77c17
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Sun Jan 04 17:30:00 2009 +0000
+++ b/src/video/x11/SDL_x11events.c	Sun Jan 04 18:29:20 2009 +0000
@@ -280,21 +280,6 @@
         }
         break;
 
-    case MotionNotify:
-#ifdef DEBUG_MOTION
-        printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
-#endif
-        SDL_SendMouseMotion(0, 0, xevent.xmotion.x, xevent.xmotion.y, 0);
-        break;
-
-    case ButtonPress:
-        SDL_SendMouseButton(0, SDL_PRESSED, xevent.xbutton.button);
-        break;
-
-    case ButtonRelease:
-        SDL_SendMouseButton(0, SDL_RELEASED, xevent.xbutton.button);
-        break;
-
     default:{
 #if SDL_VIDEO_DRIVER_X11_XINPUT
             for (i = 0; i < SDL_GetNumMice(); ++i) {
@@ -304,6 +289,22 @@
                 mouse = SDL_GetMouse(i);
                 data = (X11_MouseData *) mouse->driverdata;
                 if (!data) {
+                    switch (xevent.type) {
+                    case MotionNotify:
+#ifdef DEBUG_MOTION
+                        printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
+#endif
+                        SDL_SendMouseMotion(0, 0, xevent.xmotion.x, xevent.xmotion.y, 0);
+                        break;
+
+                    case ButtonPress:
+                        SDL_SendMouseButton(0, SDL_PRESSED, xevent.xbutton.button);
+                        break;
+
+                    case ButtonRelease:
+                        SDL_SendMouseButton(0, SDL_RELEASED, xevent.xbutton.button);
+                        break;
+                    }
                     continue;
                 }