upgraded functions gsoc2008_manymouse
authorSzymon Wilczek <kazeuser@gmail.com>
Wed, 06 Aug 2008 08:48:43 +0000
branchgsoc2008_manymouse
changeset 3776a9c2a7071874
parent 3775 e5011833348a
child 3777 54d08ecec1cb
upgraded functions
include/SDL_mouse.h
src/SDL_compat.c
src/events/SDL_mouse.c
src/events/SDL_mouse_c.h
     1.1 --- a/include/SDL_mouse.h	Tue Aug 05 14:18:40 2008 +0000
     1.2 +++ b/include/SDL_mouse.h	Wed Aug 06 08:48:43 2008 +0000
     1.3 @@ -72,7 +72,7 @@
     1.4   *
     1.5   * \brief Get the window which currently has focus for the currently selected mouse.
     1.6   */
     1.7 -extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
     1.8 +extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index);
     1.9  
    1.10  /**
    1.11   * \fn int SDL_SetRelativeMouseMode(SDL_bool enabled)
    1.12 @@ -92,7 +92,7 @@
    1.13   *
    1.14   * \sa SDL_GetRelativeMouseMode()
    1.15   */
    1.16 -extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled, int index);
    1.17 +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index, SDL_bool enabled);
    1.18  
    1.19  /**
    1.20   * \fn SDL_bool SDL_GetRelativeMouseMode()
    1.21 @@ -101,7 +101,7 @@
    1.22   *
    1.23   * \sa SDL_SetRelativeMouseMode()
    1.24   */
    1.25 -extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
    1.26 +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index);
    1.27  
    1.28  /**
    1.29   * \fn Uint8 SDL_GetMouseState(int *x, int *y)
    1.30 @@ -113,7 +113,7 @@
    1.31   * mouse cursor position relative to the focus window for the currently
    1.32   * selected mouse.  You can pass NULL for either x or y.
    1.33   */
    1.34 -extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
    1.35 +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int index, int *x, int *y);
    1.36  
    1.37  /**
    1.38   * \fn Uint8 SDL_GetRelativeMouseState(int *x, int *y)
    1.39 @@ -124,7 +124,7 @@
    1.40   * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    1.41   * mouse deltas since the last call to SDL_GetRelativeMouseState().
    1.42   */
    1.43 -extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
    1.44 +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x, int *y);
    1.45  
    1.46  /**
    1.47   * \fn void SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y)
    1.48 @@ -210,6 +210,8 @@
    1.49  
    1.50  extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index);
    1.51  
    1.52 +extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index);
    1.53 +
    1.54  #define SDL_BUTTON(X)		(1 << ((X)-1))
    1.55  #define SDL_BUTTON_LEFT		1
    1.56  #define SDL_BUTTON_MIDDLE	2
     2.1 --- a/src/SDL_compat.c	Tue Aug 05 14:18:40 2008 +0000
     2.2 +++ b/src/SDL_compat.c	Wed Aug 06 08:48:43 2008 +0000
     2.3 @@ -256,7 +256,7 @@
     2.4              }
     2.5  
     2.6              selected = SDL_SelectMouse(event->wheel.which);
     2.7 -            SDL_GetMouseState(&x, &y);
     2.8 +            SDL_GetMouseState(selected, &x, &y);
     2.9              SDL_SelectMouse(selected);
    2.10  
    2.11              if (event->wheel.y > 0) {
     3.1 --- a/src/events/SDL_mouse.c	Tue Aug 05 14:18:40 2008 +0000
     3.2 +++ b/src/events/SDL_mouse.c	Wed Aug 06 08:48:43 2008 +0000
     3.3 @@ -174,9 +174,9 @@
     3.4  }
     3.5  
     3.6  SDL_WindowID
     3.7 -SDL_GetMouseFocusWindow()
     3.8 +SDL_GetMouseFocusWindow(int index)
     3.9  {
    3.10 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
    3.11 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    3.12  
    3.13      if (!mouse) {
    3.14          return 0;
    3.15 @@ -196,7 +196,7 @@
    3.16  }
    3.17  
    3.18  int
    3.19 -SDL_SetRelativeMouseMode(SDL_bool enabled, int index)
    3.20 +SDL_SetRelativeMouseMode(int index, SDL_bool enabled)
    3.21  {
    3.22      SDL_Mouse *mouse = SDL_GetMouse(index);
    3.23  
    3.24 @@ -224,9 +224,9 @@
    3.25  }
    3.26  
    3.27  SDL_bool
    3.28 -SDL_GetRelativeMouseMode()
    3.29 +SDL_GetRelativeMouseMode(int index)
    3.30  {
    3.31 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
    3.32 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    3.33  
    3.34      if (!mouse) {
    3.35          return SDL_FALSE;
    3.36 @@ -235,9 +235,9 @@
    3.37  }
    3.38  
    3.39  Uint8
    3.40 -SDL_GetMouseState(int *x, int *y)
    3.41 +SDL_GetMouseState(int index, int *x, int *y)
    3.42  {
    3.43 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
    3.44 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    3.45  
    3.46      if (!mouse) {
    3.47          if (x) {
    3.48 @@ -259,9 +259,9 @@
    3.49  }
    3.50  
    3.51  Uint8
    3.52 -SDL_GetRelativeMouseState(int *x, int *y)
    3.53 +SDL_GetRelativeMouseState(int index, int *x, int *y)
    3.54  {
    3.55 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
    3.56 +    SDL_Mouse *mouse = SDL_GetMouse(index);
    3.57  
    3.58      if (!mouse) {
    3.59          if (x) {
    3.60 @@ -494,10 +494,6 @@
    3.61          mouse->buttonstate |= SDL_BUTTON(button);
    3.62          break;
    3.63      case SDL_RELEASED:
    3.64 -        //if (!(mouse->buttonstate & SDL_BUTTON(button))) {
    3.65 -        //    /* Ignore this event, no state change */
    3.66 -        //    return 0;
    3.67 -        //}*/
    3.68          type = SDL_MOUSEBUTTONUP;
    3.69          mouse->buttonstate &= ~SDL_BUTTON(button);
    3.70          break;
    3.71 @@ -809,15 +805,22 @@
    3.72  
    3.73  int SDL_GetCursorsNumber(int index)
    3.74  {
    3.75 -	if(index>=SDL_num_mice)
    3.76 -	{
    3.77 -		return -1;
    3.78 -	}
    3.79 -	if(SDL_mice[index]==NULL)
    3.80 -	{
    3.81 -		return -1;
    3.82 -	}
    3.83 -	return SDL_mice[index]->total_ends;
    3.84 +	SDL_Mouse* mouse = SDL_GetMouse(index);
    3.85 +    if(!mouse)
    3.86 +    {
    3.87 +        return -1;
    3.88 +    }
    3.89 +	return mouse->total_ends;
    3.90 +}
    3.91 +
    3.92 +int SDL_GetCurrentCursor(int index)
    3.93 +{
    3.94 +    SDL_Mouse* mouse = SDL_GetMouse(index);
    3.95 +    if(!mouse)
    3.96 +    {
    3.97 +        return -1;
    3.98 +    }
    3.99 +    return mouse->current_end;
   3.100  }
   3.101  /* vi: set ts=4 sw=4 expandtab: */
   3.102  
     4.1 --- a/src/events/SDL_mouse_c.h	Tue Aug 05 14:18:40 2008 +0000
     4.2 +++ b/src/events/SDL_mouse_c.h	Wed Aug 06 08:48:43 2008 +0000
     4.3 @@ -108,16 +108,16 @@
     4.4  extern void SDL_ResetMouse(int index);
     4.5  
     4.6  /* Set the mouse focus window */
     4.7 -extern void SDL_SetMouseFocus(int index, SDL_WindowID windowID);
     4.8 +extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
     4.9  
    4.10  /* Send a mouse motion event for a mouse at an index */
    4.11 -extern int SDL_SendMouseMotion(int index, int relative, int x, int y, int z);
    4.12 +extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
    4.13  
    4.14  /* Send a mouse button event for a mouse at an index */
    4.15 -extern int SDL_SendMouseButton(int index, Uint8 state, Uint8 button);
    4.16 +extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
    4.17  
    4.18  /* Send a mouse wheel event for a mouse at an index */
    4.19 -extern int SDL_SendMouseWheel(int index, int x, int y);
    4.20 +extern int SDL_SendMouseWheel(int id, int x, int y);
    4.21  
    4.22  /* Shutdown the mouse subsystem */
    4.23  extern void SDL_MouseQuit(void);