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 69501ddb72193079
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
     1.1 --- a/include/SDL_events.h	Sat Mar 02 17:51:32 2013 -0800
     1.2 +++ b/include/SDL_events.h	Sat Mar 02 20:44:16 2013 -0800
     1.3 @@ -151,8 +151,8 @@
     1.4      Uint8 padding1;
     1.5      Uint8 padding2;
     1.6      Uint8 padding3;
     1.7 -    int data1;          /**< event dependent data */
     1.8 -    int data2;          /**< event dependent data */
     1.9 +    Sint32 data1;       /**< event dependent data */
    1.10 +    Sint32 data2;       /**< event dependent data */
    1.11  } SDL_WindowEvent;
    1.12  
    1.13  /**
    1.14 @@ -180,8 +180,8 @@
    1.15      Uint32 timestamp;
    1.16      Uint32 windowID;                            /**< The window with keyboard focus, if any */
    1.17      char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
    1.18 -    int start;                                  /**< The start cursor of selected editing text */
    1.19 -    int length;                                 /**< The length of selected editing text */
    1.20 +    Sint32 start;                               /**< The start cursor of selected editing text */
    1.21 +    Sint32 length;                              /**< The length of selected editing text */
    1.22  } SDL_TextEditingEvent;
    1.23  
    1.24  
    1.25 @@ -205,14 +205,15 @@
    1.26      Uint32 type;        /**< ::SDL_MOUSEMOTION */
    1.27      Uint32 timestamp;
    1.28      Uint32 windowID;    /**< The window with mouse focus, if any */
    1.29 +    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
    1.30      Uint8 state;        /**< The current button state */
    1.31      Uint8 padding1;
    1.32      Uint8 padding2;
    1.33      Uint8 padding3;
    1.34 -    int x;              /**< X coordinate, relative to window */
    1.35 -    int y;              /**< Y coordinate, relative to window */
    1.36 -    int xrel;           /**< The relative motion in the X direction */
    1.37 -    int yrel;           /**< The relative motion in the Y direction */
    1.38 +    Sint32 x;           /**< X coordinate, relative to window */
    1.39 +    Sint32 y;           /**< Y coordinate, relative to window */
    1.40 +    Sint32 xrel;        /**< The relative motion in the X direction */
    1.41 +    Sint32 yrel;        /**< The relative motion in the Y direction */
    1.42  } SDL_MouseMotionEvent;
    1.43  
    1.44  /**
    1.45 @@ -223,12 +224,13 @@
    1.46      Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
    1.47      Uint32 timestamp;
    1.48      Uint32 windowID;    /**< The window with mouse focus, if any */
    1.49 +    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
    1.50      Uint8 button;       /**< The mouse button index */
    1.51      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    1.52      Uint8 padding1;
    1.53      Uint8 padding2;
    1.54 -    int x;              /**< X coordinate, relative to window */
    1.55 -    int y;              /**< Y coordinate, relative to window */
    1.56 +    Sint32 x;           /**< X coordinate, relative to window */
    1.57 +    Sint32 y;           /**< Y coordinate, relative to window */
    1.58  } SDL_MouseButtonEvent;
    1.59  
    1.60  /**
    1.61 @@ -239,8 +241,9 @@
    1.62      Uint32 type;        /**< ::SDL_MOUSEWHEEL */
    1.63      Uint32 timestamp;
    1.64      Uint32 windowID;    /**< The window with mouse focus, if any */
    1.65 -    int x;              /**< The amount scrolled horizontally */
    1.66 -    int y;              /**< The amount scrolled vertically */
    1.67 +    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
    1.68 +    Sint32 x;           /**< The amount scrolled horizontally */
    1.69 +    Sint32 y;           /**< The amount scrolled vertically */
    1.70  } SDL_MouseWheelEvent;
    1.71  
    1.72  /**
    1.73 @@ -467,7 +470,7 @@
    1.74      Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
    1.75      Uint32 timestamp;
    1.76      Uint32 windowID;    /**< The associated window if any */
    1.77 -    int code;           /**< User defined event code */
    1.78 +    Sint32 code;        /**< User defined event code */
    1.79      void *data1;        /**< User defined data pointer */
    1.80      void *data2;        /**< User defined data pointer */
    1.81  } SDL_UserEvent;
     2.1 --- a/include/SDL_touch.h	Sat Mar 02 17:51:32 2013 -0800
     2.2 +++ b/include/SDL_touch.h	Sat Mar 02 20:44:16 2013 -0800
     2.3 @@ -40,30 +40,25 @@
     2.4  /* *INDENT-ON* */
     2.5  #endif
     2.6  
     2.7 -
     2.8  typedef Sint64 SDL_TouchID;
     2.9  typedef Sint64 SDL_FingerID;
    2.10  
    2.11 +typedef struct SDL_Finger
    2.12 +{
    2.13 +    SDL_FingerID id;
    2.14 +    Uint16 x;
    2.15 +    Uint16 y;
    2.16 +    Uint16 pressure;
    2.17 +    Uint16 xdelta;
    2.18 +    Uint16 ydelta;
    2.19 +    Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
    2.20 +    SDL_bool down;
    2.21 +} SDL_Finger;
    2.22  
    2.23 -struct SDL_Finger {
    2.24 -  SDL_FingerID id;
    2.25 -  Uint16 x;
    2.26 -  Uint16 y;
    2.27 -  Uint16 pressure;
    2.28 -  Uint16 xdelta;
    2.29 -  Uint16 ydelta;
    2.30 -  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
    2.31 -  SDL_bool down;
    2.32 -};
    2.33 -
    2.34 -typedef struct SDL_Touch SDL_Touch;
    2.35 -typedef struct SDL_Finger SDL_Finger;
    2.36 -
    2.37 -
    2.38 -struct SDL_Touch {
    2.39 -  
    2.40 +typedef struct SDL_Touch
    2.41 +{
    2.42    /* Free the touch when it's time */
    2.43 -  void (*FreeTouch) (SDL_Touch * touch);
    2.44 +  void (*FreeTouch) (struct SDL_Touch * touch);
    2.45    
    2.46    /* data common for tablets */
    2.47    float pressure_max, pressure_min;
    2.48 @@ -89,28 +84,23 @@
    2.49    SDL_Finger** fingers;
    2.50      
    2.51    void *driverdata;
    2.52 -};
    2.53 +} SDL_Touch;
    2.54  
    2.55 +/* Used as the device ID for mouse events simulated with touch input */
    2.56 +#define SDL_TOUCH_MOUSEID ((Uint32)-1)
    2.57  
    2.58  
    2.59  /* Function prototypes */
    2.60  
    2.61  /**
    2.62 - *  \brief Get the touch object at the given id.
    2.63 - *
    2.64 - *
    2.65 + *  \brief Get the touch object with the given id.
    2.66   */
    2.67 -  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
    2.68 -
    2.69 -
    2.70 +extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
    2.71  
    2.72  /**
    2.73 - *  \brief Get the finger object of the given touch, at the given id.
    2.74 - *
    2.75 - *
    2.76 + *  \brief Get the finger object of the given touch, with the given id.
    2.77   */
    2.78 -  extern 
    2.79 -  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
    2.80 +extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
    2.81  
    2.82  /* Ends C function definitions when using C++ */
    2.83  #ifdef __cplusplus
     3.1 --- a/src/events/SDL_mouse.c	Sat Mar 02 17:51:32 2013 -0800
     3.2 +++ b/src/events/SDL_mouse.c	Sat Mar 02 20:44:16 2013 -0800
     3.3 @@ -81,7 +81,7 @@
     3.4  #endif
     3.5      for (i = 1; i <= sizeof(mouse->buttonstate)*8; ++i) {
     3.6          if (mouse->buttonstate & SDL_BUTTON(i)) {
     3.7 -            SDL_SendMouseButton(mouse->focus, SDL_RELEASED, i);
     3.8 +            SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i);
     3.9          }
    3.10      }
    3.11      SDL_assert(mouse->buttonstate == 0);
    3.12 @@ -174,7 +174,7 @@
    3.13  }
    3.14  
    3.15  int
    3.16 -SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y)
    3.17 +SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y)
    3.18  {
    3.19      SDL_Mouse *mouse = SDL_GetMouse();
    3.20      int posted;
    3.21 @@ -252,6 +252,7 @@
    3.22          SDL_Event event;
    3.23          event.motion.type = SDL_MOUSEMOTION;
    3.24          event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
    3.25 +        event.motion.which = mouseID;
    3.26          event.motion.state = mouse->buttonstate;
    3.27          event.motion.x = mouse->x;
    3.28          event.motion.y = mouse->y;
    3.29 @@ -266,7 +267,7 @@
    3.30  }
    3.31  
    3.32  int
    3.33 -SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button)
    3.34 +SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
    3.35  {
    3.36      SDL_Mouse *mouse = SDL_GetMouse();
    3.37      int posted;
    3.38 @@ -304,11 +305,12 @@
    3.39      if (SDL_GetEventState(type) == SDL_ENABLE) {
    3.40          SDL_Event event;
    3.41          event.type = type;
    3.42 +        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
    3.43 +        event.button.which = mouseID;
    3.44          event.button.state = state;
    3.45          event.button.button = button;
    3.46          event.button.x = mouse->x;
    3.47          event.button.y = mouse->y;
    3.48 -        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
    3.49          posted = (SDL_PushEvent(&event) > 0);
    3.50      }
    3.51  
    3.52 @@ -321,7 +323,7 @@
    3.53  }
    3.54  
    3.55  int
    3.56 -SDL_SendMouseWheel(SDL_Window * window, int x, int y)
    3.57 +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y)
    3.58  {
    3.59      SDL_Mouse *mouse = SDL_GetMouse();
    3.60      int posted;
    3.61 @@ -340,6 +342,7 @@
    3.62          SDL_Event event;
    3.63          event.type = SDL_MOUSEWHEEL;
    3.64          event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
    3.65 +        event.wheel.which = mouseID;
    3.66          event.wheel.x = x;
    3.67          event.wheel.y = y;
    3.68          posted = (SDL_PushEvent(&event) > 0);
    3.69 @@ -396,7 +399,7 @@
    3.70      if (mouse->WarpMouse) {
    3.71          mouse->WarpMouse(window, x, y);
    3.72      } else {
    3.73 -        SDL_SendMouseMotion(window, 0, x, y);
    3.74 +        SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y);
    3.75      }
    3.76  }
    3.77  
     4.1 --- a/src/events/SDL_mouse_c.h	Sat Mar 02 17:51:32 2013 -0800
     4.2 +++ b/src/events/SDL_mouse_c.h	Sat Mar 02 20:44:16 2013 -0800
     4.3 @@ -25,6 +25,8 @@
     4.4  
     4.5  #include "SDL_mouse.h"
     4.6  
     4.7 +typedef Uint32 SDL_MouseID;
     4.8 +
     4.9  struct SDL_Cursor
    4.10  {
    4.11      struct SDL_Cursor *next;
    4.12 @@ -55,6 +57,7 @@
    4.13      int (*SetRelativeMouseMode) (SDL_bool enabled);
    4.14  
    4.15      /* Data common to all mice */
    4.16 +    SDL_MouseID mouseID;
    4.17      SDL_Window *focus;
    4.18      int x;
    4.19      int y;
    4.20 @@ -86,13 +89,13 @@
    4.21  extern void SDL_SetMouseFocus(SDL_Window * window);
    4.22  
    4.23  /* Send a mouse motion event */
    4.24 -extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
    4.25 +extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
    4.26  
    4.27  /* Send a mouse button event */
    4.28 -extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
    4.29 +extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button);
    4.30  
    4.31  /* Send a mouse wheel event */
    4.32 -extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
    4.33 +extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y);
    4.34  
    4.35  /* Shutdown the mouse subsystem */
    4.36  extern void SDL_MouseQuit(void);
     5.1 --- a/src/main/beos/SDL_BApp.h	Sat Mar 02 17:51:32 2013 -0800
     5.2 +++ b/src/main/beos/SDL_BApp.h	Sat Mar 02 20:44:16 2013 -0800
     5.3 @@ -221,7 +221,7 @@
     5.4  			return;
     5.5  		}
     5.6  		win = GetSDLWindow(winID);
     5.7 -		SDL_SendMouseMotion(win, 0, x, y);
     5.8 +		SDL_SendMouseMotion(win, 0, 0, x, y);
     5.9  		
    5.10  		/* Tell the application that the mouse passed over, redraw needed */
    5.11  		BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
    5.12 @@ -239,7 +239,7 @@
    5.13  			return;
    5.14  		}
    5.15  		win = GetSDLWindow(winID);
    5.16 -		SDL_SendMouseButton(win, state, button);
    5.17 +		SDL_SendMouseButton(win, 0, state, button);
    5.18  	}
    5.19  	
    5.20  	void _HandleMouseWheel(BMessage *msg) {
    5.21 @@ -254,7 +254,7 @@
    5.22  			return;
    5.23  		}
    5.24  		win = GetSDLWindow(winID);
    5.25 -		SDL_SendMouseWheel(win, xTicks, yTicks);
    5.26 +		SDL_SendMouseWheel(win, 0, xTicks, yTicks);
    5.27  	}
    5.28  	
    5.29  	void _HandleKey(BMessage *msg) {
     6.1 --- a/src/video/android/SDL_androidtouch.c	Sat Mar 02 17:51:32 2013 -0800
     6.2 +++ b/src/video/android/SDL_androidtouch.c	Sat Mar 02 20:44:16 2013 -0800
     6.3 @@ -89,10 +89,10 @@
     6.4                  Android_GetWindowCoordinates(x, y, &window_x, &window_y);
     6.5  
     6.6                  /* send moved event */
     6.7 -                SDL_SendMouseMotion(NULL, 0, window_x, window_y);
     6.8 +                SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
     6.9  
    6.10                  /* send mouse down event */
    6.11 -                SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
    6.12 +                SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
    6.13  
    6.14                  leftFingerDown = fingerId;
    6.15              }
    6.16 @@ -103,7 +103,7 @@
    6.17                  Android_GetWindowCoordinates(x, y, &window_x, &window_y);
    6.18  
    6.19                  /* send moved event */
    6.20 -                SDL_SendMouseMotion(NULL, 0, window_x, window_y);
    6.21 +                SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
    6.22              }
    6.23              SDL_SendTouchMotion(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
    6.24              break;
    6.25 @@ -111,7 +111,7 @@
    6.26          case ACTION_POINTER_1_UP:
    6.27              if (fingerId == leftFingerDown) {
    6.28                  /* send mouse up */
    6.29 -                SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
    6.30 +                SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
    6.31                  leftFingerDown = 0;
    6.32              }
    6.33              SDL_SendFingerDown(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
     7.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Sat Mar 02 17:51:32 2013 -0800
     7.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Sat Mar 02 20:44:16 2013 -0800
     7.3 @@ -223,13 +223,15 @@
     7.4           [event type] == NSOtherMouseDragged)) {
     7.5          float x = [event deltaX];
     7.6          float y = [event deltaY];
     7.7 -        SDL_SendMouseMotion(mouse->focus, 1, (int)x, (int)y);
     7.8 +        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 1, (int)x, (int)y);
     7.9      }
    7.10  }
    7.11  
    7.12  void
    7.13  Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
    7.14  {
    7.15 +    SDL_Mouse *mouse = SDL_GetMouse();
    7.16 +
    7.17      float x = [event deltaX];
    7.18      float y = [event deltaY];
    7.19  
    7.20 @@ -243,7 +245,7 @@
    7.21      } else if (y < 0) {
    7.22          y -= 0.9f;
    7.23      }
    7.24 -    SDL_SendMouseWheel(window, (int)x, (int)y);
    7.25 +    SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y);
    7.26  }
    7.27  
    7.28  void
     8.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sat Mar 02 17:51:32 2013 -0800
     8.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Mar 02 20:44:16 2013 -0800
     8.3 @@ -200,7 +200,7 @@
     8.4          y = (int)(window->h - point.y);
     8.5  
     8.6          if (x >= 0 && x < window->w && y >= 0 && y < window->h) {
     8.7 -            SDL_SendMouseMotion(window, 0, x, y);
     8.8 +            SDL_SendMouseMotion(window, 0, 0, x, y);
     8.9              SDL_SetCursor(NULL);
    8.10          }
    8.11      }
    8.12 @@ -263,7 +263,7 @@
    8.13          button = [theEvent buttonNumber] + 1;
    8.14          break;
    8.15      }
    8.16 -    SDL_SendMouseButton(_data->window, SDL_PRESSED, button);
    8.17 +    SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button);
    8.18  }
    8.19  
    8.20  - (void)rightMouseDown:(NSEvent *)theEvent
    8.21 @@ -294,7 +294,7 @@
    8.22          button = [theEvent buttonNumber] + 1;
    8.23          break;
    8.24      }
    8.25 -    SDL_SendMouseButton(_data->window, SDL_RELEASED, button);
    8.26 +    SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button);
    8.27  }
    8.28  
    8.29  - (void)rightMouseUp:(NSEvent *)theEvent
    8.30 @@ -342,7 +342,7 @@
    8.31              CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
    8.32          }
    8.33      }
    8.34 -    SDL_SendMouseMotion(window, 0, x, y);
    8.35 +    SDL_SendMouseMotion(window, 0, 0, x, y);
    8.36  }
    8.37  
    8.38  - (void)mouseDragged:(NSEvent *)theEvent
     9.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Sat Mar 02 17:51:32 2013 -0800
     9.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Sat Mar 02 20:44:16 2013 -0800
     9.3 @@ -40,13 +40,13 @@
     9.4  #include "SDL_DirectFB_events.h"
     9.5  
     9.6  #if USE_MULTI_API
     9.7 -#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(id, relative, x, y, p)
     9.8 -#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(id, state, button)
     9.9 +#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y, p)
    9.10 +#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button)
    9.11  #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode)
    9.12  #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text)
    9.13  #else
    9.14 -#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, relative, x, y)
    9.15 -#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, state, button)
    9.16 +#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y)
    9.17 +#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button)
    9.18  #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode)
    9.19  #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text)
    9.20  #endif
    10.1 --- a/src/video/nds/SDL_ndsevents.c	Sat Mar 02 17:51:32 2013 -0800
    10.2 +++ b/src/video/nds/SDL_ndsevents.c	Sat Mar 02 20:44:16 2013 -0800
    10.3 @@ -37,15 +37,15 @@
    10.4      scanKeys();
    10.5      /* TODO: defer click-age */
    10.6      if (keysDown() & KEY_TOUCH) {
    10.7 -        SDL_SendMouseButton(0, SDL_PRESSED, 0);
    10.8 +        SDL_SendMouseButton(NULL, 0, SDL_PRESSED, 0);
    10.9      } else if (keysUp() & KEY_TOUCH) {
   10.10 -        SDL_SendMouseButton(0, SDL_RELEASED, 0);
   10.11 +        SDL_SendMouseButton(NULL, 0, SDL_RELEASED, 0);
   10.12      }
   10.13      if (keysHeld() & KEY_TOUCH) {
   10.14  		touchPosition t;
   10.15  
   10.16  		touchRead(&t);
   10.17 -        SDL_SendMouseMotion(0, 0, t.px, t.py);
   10.18 +        SDL_SendMouseMotion(NULL, 0, 0, t.px, t.py);
   10.19      }
   10.20  }
   10.21  
    11.1 --- a/src/video/uikit/SDL_uikitview.m	Sat Mar 02 17:51:32 2013 -0800
    11.2 +++ b/src/video/uikit/SDL_uikitview.m	Sat Mar 02 20:44:16 2013 -0800
    11.3 @@ -104,10 +104,10 @@
    11.4              CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
    11.5  
    11.6              /* send moved event */
    11.7 -            SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
    11.8 +            SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
    11.9  
   11.10              /* send mouse down event */
   11.11 -            SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
   11.12 +            SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
   11.13  
   11.14              leftFingerDown = (SDL_FingerID)touch;
   11.15          }
   11.16 @@ -144,7 +144,7 @@
   11.17      while(touch) {
   11.18          if ((SDL_FingerID)touch == leftFingerDown) {
   11.19              /* send mouse up */
   11.20 -            SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
   11.21 +            SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
   11.22              leftFingerDown = 0;
   11.23          }
   11.24  
   11.25 @@ -189,7 +189,7 @@
   11.26              CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
   11.27  
   11.28              /* send moved event */
   11.29 -            SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
   11.30 +            SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
   11.31          }
   11.32  
   11.33          CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
    12.1 --- a/src/video/windows/SDL_windowsevents.c	Sat Mar 02 17:51:32 2013 -0800
    12.2 +++ b/src/video/windows/SDL_windowsevents.c	Sat Mar 02 20:44:16 2013 -0800
    12.3 @@ -191,11 +191,11 @@
    12.4  {
    12.5  	if ( bwParamMousePressed && !bSDLMousePressed )
    12.6  	{
    12.7 -		SDL_SendMouseButton(data->window, SDL_PRESSED, button);
    12.8 +		SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button);
    12.9  	}
   12.10  	else if ( !bwParamMousePressed && bSDLMousePressed )
   12.11  	{
   12.12 -		SDL_SendMouseButton(data->window, SDL_RELEASED, button);
   12.13 +		SDL_SendMouseButton(data->window, 0, SDL_RELEASED, button);
   12.14  	}
   12.15  }
   12.16  
   12.17 @@ -376,7 +376,7 @@
   12.18  
   12.19  	case WM_MOUSEMOVE:
   12.20  		if( !SDL_GetMouse()->relative_mode )
   12.21 -	        SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam));
   12.22 +	        SDL_SendMouseMotion(data->window, 0, 0, LOWORD(lParam), HIWORD(lParam));
   12.23  		/* don't break here, fall through to check the wParam like the button presses */
   12.24  	case WM_LBUTTONUP:
   12.25  	case WM_RBUTTONUP:
   12.26 @@ -408,7 +408,7 @@
   12.27  
   12.28  			if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE)
   12.29  			{
   12.30 -				SDL_SendMouseMotion(data->window, 1, (int)mouse->lLastX, (int)mouse->lLastY);
   12.31 +				SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
   12.32  			}
   12.33  			else
   12.34  			{
   12.35 @@ -420,7 +420,7 @@
   12.36  					initialMousePoint.y = mouse->lLastY;
   12.37  				}
   12.38  
   12.39 -				SDL_SendMouseMotion(data->window, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
   12.40 +				SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
   12.41  
   12.42  				initialMousePoint.x = mouse->lLastX;
   12.43  				initialMousePoint.y = mouse->lLastY;
   12.44 @@ -435,7 +435,7 @@
   12.45              // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
   12.46              short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
   12.47  
   12.48 -            SDL_SendMouseWheel(data->window, 0, motion);
   12.49 +            SDL_SendMouseWheel(data->window, 0, 0, motion);
   12.50              break;
   12.51          }
   12.52  
    13.1 --- a/src/video/x11/SDL_x11events.c	Sat Mar 02 17:51:32 2013 -0800
    13.2 +++ b/src/video/x11/SDL_x11events.c	Sat Mar 02 20:44:16 2013 -0800
    13.3 @@ -448,24 +448,23 @@
    13.4                  printf("window %p: X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
    13.5  #endif
    13.6  
    13.7 -                SDL_SendMouseMotion(data->window, 0, xevent.xmotion.x, xevent.xmotion.y);
    13.8 +                SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y);
    13.9              }
   13.10          }
   13.11          break;
   13.12  
   13.13      case ButtonPress:{
   13.14              int ticks = 0;
   13.15 -            if (X11_IsWheelEvent(display,&xevent,&ticks) == SDL_TRUE) {
   13.16 -                SDL_SendMouseWheel(data->window, 0, ticks);
   13.17 -            }
   13.18 -            else {
   13.19 -                SDL_SendMouseButton(data->window, SDL_PRESSED, xevent.xbutton.button);
   13.20 +            if (X11_IsWheelEvent(display,&xevent,&ticks)) {
   13.21 +                SDL_SendMouseWheel(data->window, 0, 0, ticks);
   13.22 +            } else {
   13.23 +                SDL_SendMouseButton(data->window, 0, SDL_PRESSED, xevent.xbutton.button);
   13.24              }
   13.25          }
   13.26          break;
   13.27  
   13.28      case ButtonRelease:{
   13.29 -            SDL_SendMouseButton(data->window, SDL_RELEASED, xevent.xbutton.button);
   13.30 +            SDL_SendMouseButton(data->window, 0, SDL_RELEASED, xevent.xbutton.button);
   13.31          }
   13.32          break;
   13.33  
    14.1 --- a/src/video/x11/SDL_x11xinput2.c	Sat Mar 02 17:51:32 2013 -0800
    14.2 +++ b/src/video/x11/SDL_x11xinput2.c	Sat Mar 02 20:44:16 2013 -0800
    14.3 @@ -142,7 +142,7 @@
    14.4  
    14.5              parse_valuators(rawev->raw_values,rawev->valuators.mask,
    14.6                              rawev->valuators.mask_len,relative_cords,2);
    14.7 -            SDL_SendMouseMotion(mouse->focus,1,(int)relative_cords[0],(int)relative_cords[1]);
    14.8 +            SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_cords[0],(int)relative_cords[1]);
    14.9              return 1;
   14.10              }
   14.11              break;