Pressure levels. Documentation http://wilku.ravenlord.ws/doku.php?id=documentation
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SDL_config.h"
24 #include "SDL_x11video.h"
26 #include "../../events/SDL_mouse_c.h"
31 extern XDevice **SDL_XDevices;
33 int i,j,index=0, numOfDevices;
34 extern int SDL_NumOfXDevices;
36 XAnyClassPtr deviceClass;
37 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
39 DevList=XListInputDevices(data->display, &numOfDevices);
40 SDL_XDevices=(XDevice**) SDL_malloc(sizeof(XDevice));
41 for(i=0;i<numOfDevices;++i)
43 if((DevList[i].use!=IsXPointer && DevList[i].use!=IsXKeyboard))
45 deviceClass=DevList[i].inputclassinfo;
46 for(j=0;j<DevList[i].num_classes;++j)
48 if(deviceClass->class==ValuatorClass)
50 XValuatorInfo* valInfo;
51 newDevices= (XDevice**) SDL_realloc(SDL_XDevices, (index+1)*sizeof(*newDevices));
57 SDL_XDevices=newDevices;
58 SDL_XDevices[index]=XOpenDevice(data->display,DevList[i].id);
61 SDL_SetIndexId(DevList[i].id,index);
62 valInfo=(XValuatorInfo*)deviceClass;
63 if(valInfo->num_axes>2)
65 data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,valInfo->axes[2].max_value,valInfo->axes[2].min_value);
69 data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,0,0);
73 deviceClass=(XAnyClassPtr)((char*)deviceClass + deviceClass->length);
77 XFreeDeviceList(DevList);
78 SDL_NumOfXDevices=index;
84 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
89 /* vi: set ts=4 sw=4 expandtab: */