# HG changeset patch # User Szymon Wilczek # Date 1215336296 0 # Node ID 24db5d326f57eb4e0ec47cf0546e0ce8cff8c17c # Parent ed9b7fe8f902614b3abca005b79623434603bfd8 Pressure levels. Documentation http://wilku.ravenlord.ws/doku.php?id=documentation diff -r ed9b7fe8f902 -r 24db5d326f57 include/SDL_events.h --- a/include/SDL_events.h Sat Jul 05 20:02:07 2008 +0000 +++ b/include/SDL_events.h Sun Jul 06 09:24:56 2008 +0000 @@ -176,6 +176,8 @@ int y; /**< Y coordinate, relative to window */ int z; /**< Z coordinate, for future use*/ int pressure; /**< Pressure reported by tablets */ + int pressure_max; /**< Maximum value of the pressure reported by the device*/ + int pressure_min; /**< Minimum value of the pressure reported by the device*/ int rotation; /**name=SDL_malloc(strlen(name)*sizeof(char)); strcpy(SDL_mice[index]->name,name); + SDL_mice[index]->pressure_max=pressure_max; + SDL_mice[index]->pressure_min=pressure_min; SDL_mice[index]->cursor_shown = SDL_TRUE; selected_mouse = SDL_SelectMouse(index); SDL_mice[index]->cur_cursor = NULL; @@ -368,8 +370,6 @@ /* Push the cursor around */ xrel = x - last_x; yrel = y - last_y; - //x = (mouse->x + xrel); - //y = (mouse->y + yrel); } else { xrel = x - last_x; yrel = y - last_y; @@ -438,6 +438,8 @@ event.motion.xrel = xrel; event.motion.yrel = yrel; event.motion.windowID = mouse->focus; + event.motion.pressure_max=mouse->pressure_max; + event.motion.pressure_min=mouse->pressure_min; posted = (SDL_PushEvent(&event) > 0); } last_x=x; diff -r ed9b7fe8f902 -r 24db5d326f57 src/events/SDL_mouse_c.h --- a/src/events/SDL_mouse_c.h Sat Jul 05 20:02:07 2008 +0000 +++ b/src/events/SDL_mouse_c.h Sun Jul 06 09:24:56 2008 +0000 @@ -65,6 +65,8 @@ int xdelta; int ydelta; int pressure; + int pressure_max; + int pressure_min; int tilt;/*for future use*/ int rotation;/*for future use*/ char* name; @@ -91,7 +93,7 @@ /* Add a mouse, possibly reattaching at a particular index (or -1), returning the index of the mouse, or -1 if there was an error. */ -extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name); +extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name, int pressure_max, int pressure_min); /* Remove a mouse at an index, clearing the slot for later */ extern void SDL_DelMouse(int index); diff -r ed9b7fe8f902 -r 24db5d326f57 src/video/x11/SDL_x11mouse.c --- a/src/video/x11/SDL_x11mouse.c Sat Jul 05 20:02:07 2008 +0000 +++ b/src/video/x11/SDL_x11mouse.c Sun Jul 06 09:24:56 2008 +0000 @@ -47,6 +47,7 @@ { if(deviceClass->class==ValuatorClass) { + XValuatorInfo* valInfo; newDevices= (XDevice**) SDL_realloc(SDL_XDevices, (index+1)*sizeof(*newDevices)); if(!newDevices) { @@ -58,7 +59,15 @@ SDL_Mouse mouse; SDL_zero(mouse); SDL_SetIndexId(DevList[i].id,index); - data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name); + valInfo=(XValuatorInfo*)deviceClass; + if(valInfo->num_axes>2) + { + data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,valInfo->axes[2].max_value,valInfo->axes[2].min_value); + } + else + { + data->mouse = SDL_AddMouse(&mouse, index++,DevList[i].name,0,0); + } break; } deviceClass=(XAnyClassPtr)((char*)deviceClass + deviceClass->length);