src/video/x11/SDL_x11mouse.c
branchgsoc2008_manymouse
changeset 3766 24db5d326f57
parent 3761 e0c95ad1ba87
child 3772 9087a84cba51
     1.1 --- a/src/video/x11/SDL_x11mouse.c	Sat Jul 05 20:02:07 2008 +0000
     1.2 +++ b/src/video/x11/SDL_x11mouse.c	Sun Jul 06 09:24:56 2008 +0000
     1.3 @@ -47,6 +47,7 @@
     1.4              {
     1.5                  if(deviceClass->class==ValuatorClass)
     1.6                  {
     1.7 +                    XValuatorInfo* valInfo;
     1.8                      newDevices= (XDevice**) SDL_realloc(SDL_XDevices, (index+1)*sizeof(*newDevices));
     1.9                      if(!newDevices)
    1.10                      {
    1.11 @@ -58,7 +59,15 @@
    1.12                      SDL_Mouse mouse;
    1.13                      SDL_zero(mouse);
    1.14                      SDL_SetIndexId(DevList[i].id,index);
    1.15 -                    data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name);
    1.16 +                    valInfo=(XValuatorInfo*)deviceClass;
    1.17 +                    if(valInfo->num_axes>2)
    1.18 +                    {
    1.19 +                        data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,valInfo->axes[2].max_value,valInfo->axes[2].min_value);
    1.20 +                    }
    1.21 +                    else
    1.22 +                    {
    1.23 +                         data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,0,0);
    1.24 +                    }
    1.25                      break;
    1.26                  }
    1.27                  deviceClass=(XAnyClassPtr)((char*)deviceClass + deviceClass->length);