changeset 3776:a9c2a7071874 gsoc2008_manymouse

upgraded functions
author Szymon Wilczek <kazeuser@gmail.com>
date Wed, 06 Aug 2008 08:48:43 +0000
parents e5011833348a
children 54d08ecec1cb
files include/SDL_mouse.h src/SDL_compat.c src/events/SDL_mouse.c src/events/SDL_mouse_c.h
diffstat 4 files changed, 37 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_mouse.h	Tue Aug 05 14:18:40 2008 +0000
+++ b/include/SDL_mouse.h	Wed Aug 06 08:48:43 2008 +0000
@@ -72,7 +72,7 @@
  *
  * \brief Get the window which currently has focus for the currently selected mouse.
  */
-extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
+extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index);
 
 /**
  * \fn int SDL_SetRelativeMouseMode(SDL_bool enabled)
@@ -92,7 +92,7 @@
  *
  * \sa SDL_GetRelativeMouseMode()
  */
-extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled, int index);
+extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index, SDL_bool enabled);
 
 /**
  * \fn SDL_bool SDL_GetRelativeMouseMode()
@@ -101,7 +101,7 @@
  *
  * \sa SDL_SetRelativeMouseMode()
  */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
+extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index);
 
 /**
  * \fn Uint8 SDL_GetMouseState(int *x, int *y)
@@ -113,7 +113,7 @@
  * mouse cursor position relative to the focus window for the currently
  * selected mouse.  You can pass NULL for either x or y.
  */
-extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
+extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int index, int *x, int *y);
 
 /**
  * \fn Uint8 SDL_GetRelativeMouseState(int *x, int *y)
@@ -124,7 +124,7 @@
  * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
  * mouse deltas since the last call to SDL_GetRelativeMouseState().
  */
-extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
+extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x, int *y);
 
 /**
  * \fn void SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y)
@@ -210,6 +210,8 @@
 
 extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index);
 
+extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index);
+
 #define SDL_BUTTON(X)		(1 << ((X)-1))
 #define SDL_BUTTON_LEFT		1
 #define SDL_BUTTON_MIDDLE	2
--- a/src/SDL_compat.c	Tue Aug 05 14:18:40 2008 +0000
+++ b/src/SDL_compat.c	Wed Aug 06 08:48:43 2008 +0000
@@ -256,7 +256,7 @@
             }
 
             selected = SDL_SelectMouse(event->wheel.which);
-            SDL_GetMouseState(&x, &y);
+            SDL_GetMouseState(selected, &x, &y);
             SDL_SelectMouse(selected);
 
             if (event->wheel.y > 0) {
--- a/src/events/SDL_mouse.c	Tue Aug 05 14:18:40 2008 +0000
+++ b/src/events/SDL_mouse.c	Wed Aug 06 08:48:43 2008 +0000
@@ -174,9 +174,9 @@
 }
 
 SDL_WindowID
-SDL_GetMouseFocusWindow()
+SDL_GetMouseFocusWindow(int index)
 {
-    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
 
     if (!mouse) {
         return 0;
@@ -196,7 +196,7 @@
 }
 
 int
-SDL_SetRelativeMouseMode(SDL_bool enabled, int index)
+SDL_SetRelativeMouseMode(int index, SDL_bool enabled)
 {
     SDL_Mouse *mouse = SDL_GetMouse(index);
 
@@ -224,9 +224,9 @@
 }
 
 SDL_bool
-SDL_GetRelativeMouseMode()
+SDL_GetRelativeMouseMode(int index)
 {
-    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
 
     if (!mouse) {
         return SDL_FALSE;
@@ -235,9 +235,9 @@
 }
 
 Uint8
-SDL_GetMouseState(int *x, int *y)
+SDL_GetMouseState(int index, int *x, int *y)
 {
-    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
 
     if (!mouse) {
         if (x) {
@@ -259,9 +259,9 @@
 }
 
 Uint8
-SDL_GetRelativeMouseState(int *x, int *y)
+SDL_GetRelativeMouseState(int index, int *x, int *y)
 {
-    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
 
     if (!mouse) {
         if (x) {
@@ -494,10 +494,6 @@
         mouse->buttonstate |= SDL_BUTTON(button);
         break;
     case SDL_RELEASED:
-        //if (!(mouse->buttonstate & SDL_BUTTON(button))) {
-        //    /* Ignore this event, no state change */
-        //    return 0;
-        //}*/
         type = SDL_MOUSEBUTTONUP;
         mouse->buttonstate &= ~SDL_BUTTON(button);
         break;
@@ -809,15 +805,22 @@
 
 int SDL_GetCursorsNumber(int index)
 {
-	if(index>=SDL_num_mice)
-	{
-		return -1;
-	}
-	if(SDL_mice[index]==NULL)
-	{
-		return -1;
-	}
-	return SDL_mice[index]->total_ends;
+	SDL_Mouse* mouse = SDL_GetMouse(index);
+    if(!mouse)
+    {
+        return -1;
+    }
+	return mouse->total_ends;
+}
+
+int SDL_GetCurrentCursor(int index)
+{
+    SDL_Mouse* mouse = SDL_GetMouse(index);
+    if(!mouse)
+    {
+        return -1;
+    }
+    return mouse->current_end;
 }
 /* vi: set ts=4 sw=4 expandtab: */
 
--- a/src/events/SDL_mouse_c.h	Tue Aug 05 14:18:40 2008 +0000
+++ b/src/events/SDL_mouse_c.h	Wed Aug 06 08:48:43 2008 +0000
@@ -108,16 +108,16 @@
 extern void SDL_ResetMouse(int index);
 
 /* Set the mouse focus window */
-extern void SDL_SetMouseFocus(int index, SDL_WindowID windowID);
+extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
 
 /* Send a mouse motion event for a mouse at an index */
-extern int SDL_SendMouseMotion(int index, int relative, int x, int y, int z);
+extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
 
 /* Send a mouse button event for a mouse at an index */
-extern int SDL_SendMouseButton(int index, Uint8 state, Uint8 button);
+extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
 
 /* Send a mouse wheel event for a mouse at an index */
-extern int SDL_SendMouseWheel(int index, int x, int y);
+extern int SDL_SendMouseWheel(int id, int x, int y);
 
 /* Shutdown the mouse subsystem */
 extern void SDL_MouseQuit(void);