src/events/SDL_mouse.c
branchgsoc2008_manymouse
changeset 3767 abc8acb8e3d7
parent 3766 24db5d326f57
child 3769 fe32943f86ec
     1.1 --- a/src/events/SDL_mouse.c	Sun Jul 06 09:24:56 2008 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Wed Jul 23 16:12:43 2008 +0000
     1.3 @@ -28,12 +28,12 @@
     1.4  #include "default_cursor.h"
     1.5  
     1.6  
     1.7 -static int SDL_num_mice;
     1.8 -static int SDL_current_mouse;
     1.9 -static SDL_Mouse **SDL_mice;
    1.10 -int *SDL_IdIndex;
    1.11 -int SDL_highestId;
    1.12 -int last_x, last_y;
    1.13 +static int SDL_num_mice=0;
    1.14 +static int SDL_current_mouse=-1;
    1.15 +static SDL_Mouse **SDL_mice=NULL;
    1.16 +static int *SDL_IdIndex=NULL;
    1.17 +static int SDL_highestId=-1;
    1.18 +static int last_x, last_y;
    1.19  int x_max, y_max;
    1.20  /* Public functions */
    1.21  int
    1.22 @@ -56,7 +56,7 @@
    1.23  {
    1.24      SDL_Mouse **mice;
    1.25      int selected_mouse;
    1.26 -    char* temp_name;
    1.27 +    //char* temp_name;
    1.28      /* Add the mouse to the list of mice */
    1.29      if (index < 0 || index >= SDL_num_mice || SDL_mice[index]) {
    1.30          mice =
    1.31 @@ -76,8 +76,8 @@
    1.32          return -1;
    1.33      }
    1.34      *SDL_mice[index] = *mouse;
    1.35 -    SDL_mice[index]->name=SDL_malloc(strlen(name)*sizeof(char));
    1.36 -    strcpy(SDL_mice[index]->name,name);
    1.37 +    SDL_mice[index]->name=SDL_malloc(SDL_strlen(name)*sizeof(char));
    1.38 +    SDL_strlcpy(SDL_mice[index]->name,name,255);
    1.39      SDL_mice[index]->pressure_max=pressure_max;
    1.40      SDL_mice[index]->pressure_min=pressure_min;
    1.41      SDL_mice[index]->cursor_shown = SDL_TRUE;
    1.42 @@ -721,7 +721,7 @@
    1.43      return shown;
    1.44  }
    1.45  
    1.46 -void SDL_SetIndexId(int id, int index)
    1.47 +int SDL_SetIndexId(int id, int index)
    1.48  {
    1.49      if(id>SDL_highestId)
    1.50      {
    1.51 @@ -741,6 +741,7 @@
    1.52      {
    1.53          SDL_IdIndex[id]=index;
    1.54      }
    1.55 +	return 1;
    1.56  }
    1.57  
    1.58  int SDL_GetIndexById(int id)