Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Pressure levels. Documentation http://wilku.ravenlord.ws/doku.php?id=…
  • Loading branch information
Szymon Wilczek committed Jul 6, 2008
1 parent 4f71740 commit a6ec94a8717ba8e6714278fcd6e23ec832cbdfe4
Showing with 20 additions and 5 deletions.
  1. +2 −0 include/SDL_events.h
  2. +5 −3 src/events/SDL_mouse.c
  3. +3 −1 src/events/SDL_mouse_c.h
  4. +10 −1 src/video/x11/SDL_x11mouse.c
@@ -176,6 +176,8 @@ typedef struct SDL_MouseMotionEvent
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; /**<For future use */
int tilt; /**<For future use */
int xrel; /**< The relative motion in the X direction */
@@ -52,7 +52,7 @@ SDL_GetMouse(int index)
}

int
SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name)
SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,int pressure_max,int pressure_min)
{
SDL_Mouse **mice;
int selected_mouse;
@@ -78,6 +78,8 @@ SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name)
*SDL_mice[index] = *mouse;
SDL_mice[index]->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 @@ SDL_SendMouseMotion(int id, int relative, int x, int y,int z)
/* 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.which = (Uint8) index;
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;
@@ -65,6 +65,8 @@ struct SDL_Mouse
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 @@ extern SDL_Mouse *SDL_GetMouse(int index);
/* 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);
@@ -47,6 +47,7 @@ X11_InitMouse(_THIS)
{
if(deviceClass->class==ValuatorClass)
{
XValuatorInfo* valInfo;
newDevices= (XDevice**) SDL_realloc(SDL_XDevices, (index+1)*sizeof(*newDevices));
if(!newDevices)
{
@@ -58,7 +59,15 @@ X11_InitMouse(_THIS)
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);

0 comments on commit a6ec94a

Please sign in to comment.