src/events/SDL_mouse.c
changeset 6950 1ddb72193079
parent 6885 700f1b25f77f
child 7037 3fedf1f25b94
     1.1 --- a/src/events/SDL_mouse.c	Sat Mar 02 17:51:32 2013 -0800
     1.2 +++ b/src/events/SDL_mouse.c	Sat Mar 02 20:44:16 2013 -0800
     1.3 @@ -81,7 +81,7 @@
     1.4  #endif
     1.5      for (i = 1; i <= sizeof(mouse->buttonstate)*8; ++i) {
     1.6          if (mouse->buttonstate & SDL_BUTTON(i)) {
     1.7 -            SDL_SendMouseButton(mouse->focus, SDL_RELEASED, i);
     1.8 +            SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i);
     1.9          }
    1.10      }
    1.11      SDL_assert(mouse->buttonstate == 0);
    1.12 @@ -174,7 +174,7 @@
    1.13  }
    1.14  
    1.15  int
    1.16 -SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y)
    1.17 +SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y)
    1.18  {
    1.19      SDL_Mouse *mouse = SDL_GetMouse();
    1.20      int posted;
    1.21 @@ -252,6 +252,7 @@
    1.22          SDL_Event event;
    1.23          event.motion.type = SDL_MOUSEMOTION;
    1.24          event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
    1.25 +        event.motion.which = mouseID;
    1.26          event.motion.state = mouse->buttonstate;
    1.27          event.motion.x = mouse->x;
    1.28          event.motion.y = mouse->y;
    1.29 @@ -266,7 +267,7 @@
    1.30  }
    1.31  
    1.32  int
    1.33 -SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button)
    1.34 +SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
    1.35  {
    1.36      SDL_Mouse *mouse = SDL_GetMouse();
    1.37      int posted;
    1.38 @@ -304,11 +305,12 @@
    1.39      if (SDL_GetEventState(type) == SDL_ENABLE) {
    1.40          SDL_Event event;
    1.41          event.type = type;
    1.42 +        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
    1.43 +        event.button.which = mouseID;
    1.44          event.button.state = state;
    1.45          event.button.button = button;
    1.46          event.button.x = mouse->x;
    1.47          event.button.y = mouse->y;
    1.48 -        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
    1.49          posted = (SDL_PushEvent(&event) > 0);
    1.50      }
    1.51  
    1.52 @@ -321,7 +323,7 @@
    1.53  }
    1.54  
    1.55  int
    1.56 -SDL_SendMouseWheel(SDL_Window * window, int x, int y)
    1.57 +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y)
    1.58  {
    1.59      SDL_Mouse *mouse = SDL_GetMouse();
    1.60      int posted;
    1.61 @@ -340,6 +342,7 @@
    1.62          SDL_Event event;
    1.63          event.type = SDL_MOUSEWHEEL;
    1.64          event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
    1.65 +        event.wheel.which = mouseID;
    1.66          event.wheel.x = x;
    1.67          event.wheel.y = y;
    1.68          posted = (SDL_PushEvent(&event) > 0);
    1.69 @@ -396,7 +399,7 @@
    1.70      if (mouse->WarpMouse) {
    1.71          mouse->WarpMouse(window, x, y);
    1.72      } else {
    1.73 -        SDL_SendMouseMotion(window, 0, x, y);
    1.74 +        SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y);
    1.75      }
    1.76  }
    1.77