src/events/SDL_mouse.c
changeset 2712 c4e697245676
parent 2710 44e49d3fa6cf
child 2718 abacf2555bb4
     1.1 --- a/src/events/SDL_mouse.c	Mon Aug 25 06:58:34 2008 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Mon Aug 25 08:50:37 2008 +0000
     1.3 @@ -76,13 +76,13 @@
     1.4      return 1;
     1.5  }
     1.6  
     1.7 -SDL_Mouse *
     1.8 -SDL_GetMouseByID(int id)
     1.9 +int
    1.10 +SDL_GetMouseIndexId(int id)
    1.11  {
    1.12      if (id < 0 || id > SDL_highestId) {
    1.13 -        return NULL;
    1.14 +        return -1;
    1.15      }
    1.16 -    return SDL_GetMouse(SDL_IdIndex[id]);
    1.17 +    return SDL_IdIndex[id];
    1.18  }
    1.19  
    1.20  int
    1.21 @@ -321,16 +321,15 @@
    1.22  void
    1.23  SDL_SetMouseFocus(int id, SDL_WindowID windowID)
    1.24  {
    1.25 -    SDL_Mouse *mouse = SDL_GetMouseByID(id);
    1.26 -    int i, index;
    1.27 +    int index = SDL_GetMouseIndexId(id);
    1.28 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    1.29 +    int i;
    1.30      SDL_bool focus;
    1.31  
    1.32      if (!mouse || (mouse->focus == windowID)) {
    1.33          return;
    1.34      }
    1.35  
    1.36 -    index = SDL_IdIndex[id];
    1.37 -
    1.38      /* See if the current window has lost focus */
    1.39      if (mouse->focus) {
    1.40          focus = SDL_FALSE;
    1.41 @@ -372,7 +371,8 @@
    1.42  int
    1.43  SDL_SendProximity(int id, int x, int y, int type)
    1.44  {
    1.45 -    SDL_Mouse *mouse = SDL_GetMouseByID(id);
    1.46 +    int index = SDL_GetMouseIndexId(id);
    1.47 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    1.48      int posted = 0;
    1.49      last_x = x;
    1.50      last_y = y;
    1.51 @@ -396,7 +396,8 @@
    1.52  int
    1.53  SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure)
    1.54  {
    1.55 -    SDL_Mouse *mouse = SDL_GetMouseByID(id);
    1.56 +    int index = SDL_GetMouseIndexId(id);
    1.57 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    1.58      int posted;
    1.59      int xrel;
    1.60      int yrel;
    1.61 @@ -491,7 +492,8 @@
    1.62  int
    1.63  SDL_SendMouseButton(int id, Uint8 state, Uint8 button)
    1.64  {
    1.65 -    SDL_Mouse *mouse = SDL_GetMouseByID(id);
    1.66 +    int index = SDL_GetMouseIndexId(id);
    1.67 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    1.68      int posted;
    1.69      Uint8 type;
    1.70  
    1.71 @@ -777,7 +779,8 @@
    1.72  void
    1.73  SDL_ChangeEnd(int id, int end)
    1.74  {
    1.75 -    SDL_Mouse *mouse = SDL_GetMouseByID(id);
    1.76 +    int index = SDL_GetMouseIndexId(id);
    1.77 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    1.78  
    1.79      if (mouse) {
    1.80          mouse->current_end = end;