src/video/x11/SDL_x11mouse.c
branchgsoc2008_manymouse
changeset 3766 24db5d326f57
parent 3761 e0c95ad1ba87
child 3772 9087a84cba51
equal deleted inserted replaced
3765:ed9b7fe8f902 3766:24db5d326f57
    45             deviceClass=DevList[i].inputclassinfo;
    45             deviceClass=DevList[i].inputclassinfo;
    46             for(j=0;j<DevList[i].num_classes;++j)
    46             for(j=0;j<DevList[i].num_classes;++j)
    47             {
    47             {
    48                 if(deviceClass->class==ValuatorClass)
    48                 if(deviceClass->class==ValuatorClass)
    49                 {
    49                 {
       
    50                     XValuatorInfo* valInfo;
    50                     newDevices= (XDevice**) SDL_realloc(SDL_XDevices, (index+1)*sizeof(*newDevices));
    51                     newDevices= (XDevice**) SDL_realloc(SDL_XDevices, (index+1)*sizeof(*newDevices));
    51                     if(!newDevices)
    52                     if(!newDevices)
    52                     {
    53                     {
    53                         SDL_OutOfMemory();
    54                         SDL_OutOfMemory();
    54                         return -1;
    55                         return -1;
    56                     SDL_XDevices=newDevices;
    57                     SDL_XDevices=newDevices;
    57                     SDL_XDevices[index]=XOpenDevice(data->display,DevList[i].id);
    58                     SDL_XDevices[index]=XOpenDevice(data->display,DevList[i].id);
    58                     SDL_Mouse mouse;
    59                     SDL_Mouse mouse;
    59                     SDL_zero(mouse);
    60                     SDL_zero(mouse);
    60                     SDL_SetIndexId(DevList[i].id,index);
    61                     SDL_SetIndexId(DevList[i].id,index);
    61                     data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name);
    62                     valInfo=(XValuatorInfo*)deviceClass;
       
    63                     if(valInfo->num_axes>2)
       
    64                     {
       
    65                         data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,valInfo->axes[2].max_value,valInfo->axes[2].min_value);
       
    66                     }
       
    67                     else
       
    68                     {
       
    69                          data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,0,0);
       
    70                     }
    62                     break;
    71                     break;
    63                 }
    72                 }
    64                 deviceClass=(XAnyClassPtr)((char*)deviceClass + deviceClass->length);
    73                 deviceClass=(XAnyClassPtr)((char*)deviceClass + deviceClass->length);
    65             }
    74             }
    66         }
    75         }