Added a mouse ID to the mouse events, which set to the special value SDL_TOUCH_MOUSEID for mouse events simulated by touch input.
authorSam Lantinga <slouken@libsdl.org>
Sat, 02 Mar 2013 20:44:16 -0800
changeset 6950 1ddb72193079
parent 6949 4de584a3a027
child 6951 7833f01322b3
Added a mouse ID to the mouse events, which set to the special value SDL_TOUCH_MOUSEID for mouse events simulated by touch input.
include/SDL_events.h
include/SDL_touch.h
src/events/SDL_mouse.c
src/events/SDL_mouse_c.h
src/main/beos/SDL_BApp.h
src/video/android/SDL_androidtouch.c
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoawindow.m
src/video/directfb/SDL_DirectFB_events.c
src/video/nds/SDL_ndsevents.c
src/video/uikit/SDL_uikitview.m
src/video/windows/SDL_windowsevents.c
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11xinput2.c
--- a/include/SDL_events.h	Sat Mar 02 17:51:32 2013 -0800
+++ b/include/SDL_events.h	Sat Mar 02 20:44:16 2013 -0800
@@ -151,8 +151,8 @@
     Uint8 padding1;
     Uint8 padding2;
     Uint8 padding3;
-    int data1;          /**< event dependent data */
-    int data2;          /**< event dependent data */
+    Sint32 data1;       /**< event dependent data */
+    Sint32 data2;       /**< event dependent data */
 } SDL_WindowEvent;
 
 /**
@@ -180,8 +180,8 @@
     Uint32 timestamp;
     Uint32 windowID;                            /**< The window with keyboard focus, if any */
     char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
-    int start;                                  /**< The start cursor of selected editing text */
-    int length;                                 /**< The length of selected editing text */
+    Sint32 start;                               /**< The start cursor of selected editing text */
+    Sint32 length;                              /**< The length of selected editing text */
 } SDL_TextEditingEvent;
 
 
@@ -205,14 +205,15 @@
     Uint32 type;        /**< ::SDL_MOUSEMOTION */
     Uint32 timestamp;
     Uint32 windowID;    /**< The window with mouse focus, if any */
+    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint8 state;        /**< The current button state */
     Uint8 padding1;
     Uint8 padding2;
     Uint8 padding3;
-    int x;              /**< X coordinate, relative to window */
-    int y;              /**< Y coordinate, relative to window */
-    int xrel;           /**< The relative motion in the X direction */
-    int yrel;           /**< The relative motion in the Y direction */
+    Sint32 x;           /**< X coordinate, relative to window */
+    Sint32 y;           /**< Y coordinate, relative to window */
+    Sint32 xrel;        /**< The relative motion in the X direction */
+    Sint32 yrel;        /**< The relative motion in the Y direction */
 } SDL_MouseMotionEvent;
 
 /**
@@ -223,12 +224,13 @@
     Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
     Uint32 timestamp;
     Uint32 windowID;    /**< The window with mouse focus, if any */
+    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint8 button;       /**< The mouse button index */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
     Uint8 padding1;
     Uint8 padding2;
-    int x;              /**< X coordinate, relative to window */
-    int y;              /**< Y coordinate, relative to window */
+    Sint32 x;           /**< X coordinate, relative to window */
+    Sint32 y;           /**< Y coordinate, relative to window */
 } SDL_MouseButtonEvent;
 
 /**
@@ -239,8 +241,9 @@
     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
     Uint32 timestamp;
     Uint32 windowID;    /**< The window with mouse focus, if any */
-    int x;              /**< The amount scrolled horizontally */
-    int y;              /**< The amount scrolled vertically */
+    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+    Sint32 x;           /**< The amount scrolled horizontally */
+    Sint32 y;           /**< The amount scrolled vertically */
 } SDL_MouseWheelEvent;
 
 /**
@@ -467,7 +470,7 @@
     Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
     Uint32 timestamp;
     Uint32 windowID;    /**< The associated window if any */
-    int code;           /**< User defined event code */
+    Sint32 code;        /**< User defined event code */
     void *data1;        /**< User defined data pointer */
     void *data2;        /**< User defined data pointer */
 } SDL_UserEvent;
--- a/include/SDL_touch.h	Sat Mar 02 17:51:32 2013 -0800
+++ b/include/SDL_touch.h	Sat Mar 02 20:44:16 2013 -0800
@@ -40,30 +40,25 @@
 /* *INDENT-ON* */
 #endif
 
-
 typedef Sint64 SDL_TouchID;
 typedef Sint64 SDL_FingerID;
 
+typedef struct SDL_Finger
+{
+    SDL_FingerID id;
+    Uint16 x;
+    Uint16 y;
+    Uint16 pressure;
+    Uint16 xdelta;
+    Uint16 ydelta;
+    Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
+    SDL_bool down;
+} SDL_Finger;
 
-struct SDL_Finger {
-  SDL_FingerID id;
-  Uint16 x;
-  Uint16 y;
-  Uint16 pressure;
-  Uint16 xdelta;
-  Uint16 ydelta;
-  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
-  SDL_bool down;
-};
-
-typedef struct SDL_Touch SDL_Touch;
-typedef struct SDL_Finger SDL_Finger;
-
-
-struct SDL_Touch {
-  
+typedef struct SDL_Touch
+{
   /* Free the touch when it's time */
-  void (*FreeTouch) (SDL_Touch * touch);
+  void (*FreeTouch) (struct SDL_Touch * touch);
   
   /* data common for tablets */
   float pressure_max, pressure_min;
@@ -89,28 +84,23 @@
   SDL_Finger** fingers;
     
   void *driverdata;
-};
+} SDL_Touch;
 
+/* Used as the device ID for mouse events simulated with touch input */
+#define SDL_TOUCH_MOUSEID ((Uint32)-1)
 
 
 /* Function prototypes */
 
 /**
- *  \brief Get the touch object at the given id.
- *
- *
+ *  \brief Get the touch object with the given id.
  */
-  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
-
-
+extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
 
 /**
- *  \brief Get the finger object of the given touch, at the given id.
- *
- *
+ *  \brief Get the finger object of the given touch, with the given id.
  */
-  extern 
-  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
+extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
--- a/src/events/SDL_mouse.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/events/SDL_mouse.c	Sat Mar 02 20:44:16 2013 -0800
@@ -81,7 +81,7 @@
 #endif
     for (i = 1; i <= sizeof(mouse->buttonstate)*8; ++i) {
         if (mouse->buttonstate & SDL_BUTTON(i)) {
-            SDL_SendMouseButton(mouse->focus, SDL_RELEASED, i);
+            SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i);
         }
     }
     SDL_assert(mouse->buttonstate == 0);
@@ -174,7 +174,7 @@
 }
 
 int
-SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y)
+SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     int posted;
@@ -252,6 +252,7 @@
         SDL_Event event;
         event.motion.type = SDL_MOUSEMOTION;
         event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
+        event.motion.which = mouseID;
         event.motion.state = mouse->buttonstate;
         event.motion.x = mouse->x;
         event.motion.y = mouse->y;
@@ -266,7 +267,7 @@
 }
 
 int
-SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button)
+SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     int posted;
@@ -304,11 +305,12 @@
     if (SDL_GetEventState(type) == SDL_ENABLE) {
         SDL_Event event;
         event.type = type;
+        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
+        event.button.which = mouseID;
         event.button.state = state;
         event.button.button = button;
         event.button.x = mouse->x;
         event.button.y = mouse->y;
-        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
         posted = (SDL_PushEvent(&event) > 0);
     }
 
@@ -321,7 +323,7 @@
 }
 
 int
-SDL_SendMouseWheel(SDL_Window * window, int x, int y)
+SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     int posted;
@@ -340,6 +342,7 @@
         SDL_Event event;
         event.type = SDL_MOUSEWHEEL;
         event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
+        event.wheel.which = mouseID;
         event.wheel.x = x;
         event.wheel.y = y;
         posted = (SDL_PushEvent(&event) > 0);
@@ -396,7 +399,7 @@
     if (mouse->WarpMouse) {
         mouse->WarpMouse(window, x, y);
     } else {
-        SDL_SendMouseMotion(window, 0, x, y);
+        SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y);
     }
 }
 
--- a/src/events/SDL_mouse_c.h	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/events/SDL_mouse_c.h	Sat Mar 02 20:44:16 2013 -0800
@@ -25,6 +25,8 @@
 
 #include "SDL_mouse.h"
 
+typedef Uint32 SDL_MouseID;
+
 struct SDL_Cursor
 {
     struct SDL_Cursor *next;
@@ -55,6 +57,7 @@
     int (*SetRelativeMouseMode) (SDL_bool enabled);
 
     /* Data common to all mice */
+    SDL_MouseID mouseID;
     SDL_Window *focus;
     int x;
     int y;
@@ -86,13 +89,13 @@
 extern void SDL_SetMouseFocus(SDL_Window * window);
 
 /* Send a mouse motion event */
-extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
+extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
 
 /* Send a mouse button event */
-extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
+extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button);
 
 /* Send a mouse wheel event */
-extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
+extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y);
 
 /* Shutdown the mouse subsystem */
 extern void SDL_MouseQuit(void);
--- a/src/main/beos/SDL_BApp.h	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/main/beos/SDL_BApp.h	Sat Mar 02 20:44:16 2013 -0800
@@ -221,7 +221,7 @@
 			return;
 		}
 		win = GetSDLWindow(winID);
-		SDL_SendMouseMotion(win, 0, x, y);
+		SDL_SendMouseMotion(win, 0, 0, x, y);
 		
 		/* Tell the application that the mouse passed over, redraw needed */
 		BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
@@ -239,7 +239,7 @@
 			return;
 		}
 		win = GetSDLWindow(winID);
-		SDL_SendMouseButton(win, state, button);
+		SDL_SendMouseButton(win, 0, state, button);
 	}
 	
 	void _HandleMouseWheel(BMessage *msg) {
@@ -254,7 +254,7 @@
 			return;
 		}
 		win = GetSDLWindow(winID);
-		SDL_SendMouseWheel(win, xTicks, yTicks);
+		SDL_SendMouseWheel(win, 0, xTicks, yTicks);
 	}
 	
 	void _HandleKey(BMessage *msg) {
--- a/src/video/android/SDL_androidtouch.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/android/SDL_androidtouch.c	Sat Mar 02 20:44:16 2013 -0800
@@ -89,10 +89,10 @@
                 Android_GetWindowCoordinates(x, y, &window_x, &window_y);
 
                 /* send moved event */
-                SDL_SendMouseMotion(NULL, 0, window_x, window_y);
+                SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
 
                 /* send mouse down event */
-                SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
+                SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
 
                 leftFingerDown = fingerId;
             }
@@ -103,7 +103,7 @@
                 Android_GetWindowCoordinates(x, y, &window_x, &window_y);
 
                 /* send moved event */
-                SDL_SendMouseMotion(NULL, 0, window_x, window_y);
+                SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
             }
             SDL_SendTouchMotion(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
             break;
@@ -111,7 +111,7 @@
         case ACTION_POINTER_1_UP:
             if (fingerId == leftFingerDown) {
                 /* send mouse up */
-                SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
+                SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
                 leftFingerDown = 0;
             }
             SDL_SendFingerDown(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
--- a/src/video/cocoa/SDL_cocoamouse.m	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/cocoa/SDL_cocoamouse.m	Sat Mar 02 20:44:16 2013 -0800
@@ -223,13 +223,15 @@
          [event type] == NSOtherMouseDragged)) {
         float x = [event deltaX];
         float y = [event deltaY];
-        SDL_SendMouseMotion(mouse->focus, 1, (int)x, (int)y);
+        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 1, (int)x, (int)y);
     }
 }
 
 void
 Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
 {
+    SDL_Mouse *mouse = SDL_GetMouse();
+
     float x = [event deltaX];
     float y = [event deltaY];
 
@@ -243,7 +245,7 @@
     } else if (y < 0) {
         y -= 0.9f;
     }
-    SDL_SendMouseWheel(window, (int)x, (int)y);
+    SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y);
 }
 
 void
--- a/src/video/cocoa/SDL_cocoawindow.m	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Mar 02 20:44:16 2013 -0800
@@ -200,7 +200,7 @@
         y = (int)(window->h - point.y);
 
         if (x >= 0 && x < window->w && y >= 0 && y < window->h) {
-            SDL_SendMouseMotion(window, 0, x, y);
+            SDL_SendMouseMotion(window, 0, 0, x, y);
             SDL_SetCursor(NULL);
         }
     }
@@ -263,7 +263,7 @@
         button = [theEvent buttonNumber] + 1;
         break;
     }
-    SDL_SendMouseButton(_data->window, SDL_PRESSED, button);
+    SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button);
 }
 
 - (void)rightMouseDown:(NSEvent *)theEvent
@@ -294,7 +294,7 @@
         button = [theEvent buttonNumber] + 1;
         break;
     }
-    SDL_SendMouseButton(_data->window, SDL_RELEASED, button);
+    SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button);
 }
 
 - (void)rightMouseUp:(NSEvent *)theEvent
@@ -342,7 +342,7 @@
             CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
         }
     }
-    SDL_SendMouseMotion(window, 0, x, y);
+    SDL_SendMouseMotion(window, 0, 0, x, y);
 }
 
 - (void)mouseDragged:(NSEvent *)theEvent
--- a/src/video/directfb/SDL_DirectFB_events.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/directfb/SDL_DirectFB_events.c	Sat Mar 02 20:44:16 2013 -0800
@@ -40,13 +40,13 @@
 #include "SDL_DirectFB_events.h"
 
 #if USE_MULTI_API
-#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(id, relative, x, y, p)
-#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(id, state, button)
+#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y, p)
+#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button)
 #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode)
 #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text)
 #else
-#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, relative, x, y)
-#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, state, button)
+#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y)
+#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button)
 #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode)
 #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text)
 #endif
--- a/src/video/nds/SDL_ndsevents.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/nds/SDL_ndsevents.c	Sat Mar 02 20:44:16 2013 -0800
@@ -37,15 +37,15 @@
     scanKeys();
     /* TODO: defer click-age */
     if (keysDown() & KEY_TOUCH) {
-        SDL_SendMouseButton(0, SDL_PRESSED, 0);
+        SDL_SendMouseButton(NULL, 0, SDL_PRESSED, 0);
     } else if (keysUp() & KEY_TOUCH) {
-        SDL_SendMouseButton(0, SDL_RELEASED, 0);
+        SDL_SendMouseButton(NULL, 0, SDL_RELEASED, 0);
     }
     if (keysHeld() & KEY_TOUCH) {
 		touchPosition t;
 
 		touchRead(&t);
-        SDL_SendMouseMotion(0, 0, t.px, t.py);
+        SDL_SendMouseMotion(NULL, 0, 0, t.px, t.py);
     }
 }
 
--- a/src/video/uikit/SDL_uikitview.m	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/uikit/SDL_uikitview.m	Sat Mar 02 20:44:16 2013 -0800
@@ -104,10 +104,10 @@
             CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
 
             /* send moved event */
-            SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
+            SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
 
             /* send mouse down event */
-            SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
+            SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
 
             leftFingerDown = (SDL_FingerID)touch;
         }
@@ -144,7 +144,7 @@
     while(touch) {
         if ((SDL_FingerID)touch == leftFingerDown) {
             /* send mouse up */
-            SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
+            SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
             leftFingerDown = 0;
         }
 
@@ -189,7 +189,7 @@
             CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
 
             /* send moved event */
-            SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
+            SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
         }
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
--- a/src/video/windows/SDL_windowsevents.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/windows/SDL_windowsevents.c	Sat Mar 02 20:44:16 2013 -0800
@@ -191,11 +191,11 @@
 {
 	if ( bwParamMousePressed && !bSDLMousePressed )
 	{
-		SDL_SendMouseButton(data->window, SDL_PRESSED, button);
+		SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button);
 	}
 	else if ( !bwParamMousePressed && bSDLMousePressed )
 	{
-		SDL_SendMouseButton(data->window, SDL_RELEASED, button);
+		SDL_SendMouseButton(data->window, 0, SDL_RELEASED, button);
 	}
 }
 
@@ -376,7 +376,7 @@
 
 	case WM_MOUSEMOVE:
 		if( !SDL_GetMouse()->relative_mode )
-	        SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam));
+	        SDL_SendMouseMotion(data->window, 0, 0, LOWORD(lParam), HIWORD(lParam));
 		/* don't break here, fall through to check the wParam like the button presses */
 	case WM_LBUTTONUP:
 	case WM_RBUTTONUP:
@@ -408,7 +408,7 @@
 
 			if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE)
 			{
-				SDL_SendMouseMotion(data->window, 1, (int)mouse->lLastX, (int)mouse->lLastY);
+				SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
 			}
 			else
 			{
@@ -420,7 +420,7 @@
 					initialMousePoint.y = mouse->lLastY;
 				}
 
-				SDL_SendMouseMotion(data->window, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
+				SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
 
 				initialMousePoint.x = mouse->lLastX;
 				initialMousePoint.y = mouse->lLastY;
@@ -435,7 +435,7 @@
             // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
             short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
 
-            SDL_SendMouseWheel(data->window, 0, motion);
+            SDL_SendMouseWheel(data->window, 0, 0, motion);
             break;
         }
 
--- a/src/video/x11/SDL_x11events.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/x11/SDL_x11events.c	Sat Mar 02 20:44:16 2013 -0800
@@ -448,24 +448,23 @@
                 printf("window %p: X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
 #endif
 
-                SDL_SendMouseMotion(data->window, 0, xevent.xmotion.x, xevent.xmotion.y);
+                SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y);
             }
         }
         break;
 
     case ButtonPress:{
             int ticks = 0;
-            if (X11_IsWheelEvent(display,&xevent,&ticks) == SDL_TRUE) {
-                SDL_SendMouseWheel(data->window, 0, ticks);
-            }
-            else {
-                SDL_SendMouseButton(data->window, SDL_PRESSED, xevent.xbutton.button);
+            if (X11_IsWheelEvent(display,&xevent,&ticks)) {
+                SDL_SendMouseWheel(data->window, 0, 0, ticks);
+            } else {
+                SDL_SendMouseButton(data->window, 0, SDL_PRESSED, xevent.xbutton.button);
             }
         }
         break;
 
     case ButtonRelease:{
-            SDL_SendMouseButton(data->window, SDL_RELEASED, xevent.xbutton.button);
+            SDL_SendMouseButton(data->window, 0, SDL_RELEASED, xevent.xbutton.button);
         }
         break;
 
--- a/src/video/x11/SDL_x11xinput2.c	Sat Mar 02 17:51:32 2013 -0800
+++ b/src/video/x11/SDL_x11xinput2.c	Sat Mar 02 20:44:16 2013 -0800
@@ -142,7 +142,7 @@
 
             parse_valuators(rawev->raw_values,rawev->valuators.mask,
                             rawev->valuators.mask_len,relative_cords,2);
-            SDL_SendMouseMotion(mouse->focus,1,(int)relative_cords[0],(int)relative_cords[1]);
+            SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_cords[0],(int)relative_cords[1]);
             return 1;
             }
             break;