changeset 2712:c4e697245676

Fixed compile errors introduced during the merge refactoring
author Sam Lantinga <slouken@libsdl.org>
date Mon, 25 Aug 2008 08:50:37 +0000
parents 62e7af9b2b67
children 0906692aa6a4
files src/events/SDL_mouse.c src/events/SDL_mouse_c.h
diffstat 2 files changed, 20 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/events/SDL_mouse.c	Mon Aug 25 06:58:34 2008 +0000
+++ b/src/events/SDL_mouse.c	Mon Aug 25 08:50:37 2008 +0000
@@ -76,13 +76,13 @@
     return 1;
 }
 
-SDL_Mouse *
-SDL_GetMouseByID(int id)
+int
+SDL_GetMouseIndexId(int id)
 {
     if (id < 0 || id > SDL_highestId) {
-        return NULL;
+        return -1;
     }
-    return SDL_GetMouse(SDL_IdIndex[id]);
+    return SDL_IdIndex[id];
 }
 
 int
@@ -321,16 +321,15 @@
 void
 SDL_SetMouseFocus(int id, SDL_WindowID windowID)
 {
-    SDL_Mouse *mouse = SDL_GetMouseByID(id);
-    int i, index;
+    int index = SDL_GetMouseIndexId(id);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
+    int i;
     SDL_bool focus;
 
     if (!mouse || (mouse->focus == windowID)) {
         return;
     }
 
-    index = SDL_IdIndex[id];
-
     /* See if the current window has lost focus */
     if (mouse->focus) {
         focus = SDL_FALSE;
@@ -372,7 +371,8 @@
 int
 SDL_SendProximity(int id, int x, int y, int type)
 {
-    SDL_Mouse *mouse = SDL_GetMouseByID(id);
+    int index = SDL_GetMouseIndexId(id);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
     int posted = 0;
     last_x = x;
     last_y = y;
@@ -396,7 +396,8 @@
 int
 SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure)
 {
-    SDL_Mouse *mouse = SDL_GetMouseByID(id);
+    int index = SDL_GetMouseIndexId(id);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
     int posted;
     int xrel;
     int yrel;
@@ -491,7 +492,8 @@
 int
 SDL_SendMouseButton(int id, Uint8 state, Uint8 button)
 {
-    SDL_Mouse *mouse = SDL_GetMouseByID(id);
+    int index = SDL_GetMouseIndexId(id);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
     int posted;
     Uint8 type;
 
@@ -777,7 +779,8 @@
 void
 SDL_ChangeEnd(int id, int end)
 {
-    SDL_Mouse *mouse = SDL_GetMouseByID(id);
+    int index = SDL_GetMouseIndexId(id);
+    SDL_Mouse *mouse = SDL_GetMouse(index);
 
     if (mouse) {
         mouse->current_end = end;
--- a/src/events/SDL_mouse_c.h	Mon Aug 25 06:58:34 2008 +0000
+++ b/src/events/SDL_mouse_c.h	Mon Aug 25 08:50:37 2008 +0000
@@ -88,14 +88,14 @@
 /* Initialize the mouse subsystem */
 extern int SDL_MouseInit(void);
 
-/* Get the mouse at an index */
-extern SDL_Mouse *SDL_GetMouse(int index);
-
 /* Assign an id to a mouse at an index */
 extern int SDL_SetMouseIndexId(int id, int index);
 
-/* Get the mouse by id */
-extern SDL_Mouse *SDL_GetMouseByID(int id);
+/* Get the index of a mouse specified by id */
+extern int SDL_GetMouseIndexId(int id);
+
+/* Get the mouse at an index */
+extern SDL_Mouse *SDL_GetMouse(int index);
 
 /* Add a mouse, possibly reattaching at a particular index (or -1),
    returning the index of the mouse, or -1 if there was an error.