# HG changeset patch # User Szymon Wilczek # Date 1217945411 0 # Node ID 8b5b67000dc0c5bfeb8f234674f4cdebcb5f55cb # Parent 3b5691f85c0df6fc1711d2b1734cd38a99e65186 Cursor support added diff -r 3b5691f85c0d -r 8b5b67000dc0 include/SDL_events.h --- a/include/SDL_events.h Mon Aug 04 11:18:10 2008 +0000 +++ b/include/SDL_events.h Tue Aug 05 14:10:11 2008 +0000 @@ -180,6 +180,7 @@ int pressure_min; /**< Minimum value of the pressure reported by the device*/ int rotation; /**relative_mode=SDL_FALSE; + SDL_mice[index]->current_end=0; + SDL_mice[index]->total_ends=ends; SDL_SelectMouse(selected_mouse); return index; @@ -460,6 +463,7 @@ event.motion.windowID = mouse->focus; event.motion.pressure_max=mouse->pressure_max; event.motion.pressure_min=mouse->pressure_min; + event.motion.cursor=SDL_mice[index]->current_end; posted = (SDL_PushEvent(&event) > 0); } last_x=x; @@ -796,5 +800,24 @@ x_max=x; y_max=y; } + +void SDL_ChangeEnd(int id, int end) +{ + int index=SDL_GetIndexById(id); + SDL_mice[index]->current_end=end; +} + +int SDL_GetCursorsNumber(int index) +{ + if(index>=SDL_num_mice) + { + return -1; + } + if(SDL_mice[index]==NULL) + { + return -1; + } + return SDL_mice[index]->total_ends; +} /* vi: set ts=4 sw=4 expandtab: */ diff -r 3b5691f85c0d -r 8b5b67000dc0 src/events/SDL_mouse_c.h --- a/src/events/SDL_mouse_c.h Mon Aug 04 11:18:10 2008 +0000 +++ b/src/events/SDL_mouse_c.h Tue Aug 05 14:10:11 2008 +0000 @@ -62,6 +62,8 @@ int pressure_min; int tilt;/*for future use*/ int rotation;/*for future use*/ + int total_ends; + int current_end; /* Data common to all mice */ SDL_WindowID focus; @@ -96,7 +98,8 @@ /* 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, int pressure_max, int pressure_min); +extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,\ + int pressure_max, int pressure_min, int ends); /* Remove a mouse at an index, clearing the slot for later */ extern void SDL_DelMouse(int index); @@ -129,6 +132,10 @@ extern void SDL_UpdateCoordinates(int x, int y); +extern void SDL_ChangeEnd(int id, int end); + +extern int SDL_GetCursorsNumber(int index); + #endif /* _SDL_mouse_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff -r 3b5691f85c0d -r 8b5b67000dc0 src/video/win32/SDL_win32events.c --- a/src/video/win32/SDL_win32events.c Mon Aug 04 11:18:10 2008 +0000 +++ b/src/video/win32/SDL_win32events.c Tue Aug 05 14:10:11 2008 +0000 @@ -32,7 +32,7 @@ #include "SDL_vkeys.h" #include "../../events/SDL_events_c.h" #include -#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE) +#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR) #define PACKETMODE 0 #include @@ -141,6 +141,7 @@ /*if we receive such data we need to update the pressure*/ if (WTPacket((HCTX)lParam, wParam, &packet)) { + SDL_ChangeEnd(tablet, (int)packet.pkCursor); pressure=(int)packet.pkNormalPressure; } } diff -r 3b5691f85c0d -r 8b5b67000dc0 src/video/win32/SDL_win32mouse.c --- a/src/video/win32/SDL_win32mouse.c Mon Aug 04 11:18:10 2008 +0000 +++ b/src/video/win32/SDL_win32mouse.c Tue Aug 05 14:10:11 2008 +0000 @@ -34,7 +34,7 @@ #include "../../events/SDL_mouse_c.h" #include -#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE) +#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR) #define PACKETMODE 0 #include @@ -176,12 +176,14 @@ if(tablet==index) { AXIS pressure; + int cursors; WTInfo(WTI_DEVICES,DVC_NPRESSURE, &pressure); - data->mouse = SDL_AddMouse(&mouse, index,device_name,pressure.axMax,pressure.axMin); + WTInfo(WTI_DEVICES,DVC_NCSRTYPES, &cursors); + data->mouse = SDL_AddMouse(&mouse, index,device_name,pressure.axMax,pressure.axMin,cursors); } else { - data->mouse = SDL_AddMouse(&mouse, index,device_name,0,0); + data->mouse = SDL_AddMouse(&mouse, index,device_name,0,0,1); } ++index;