Final merge of Google Summer of Code 2008 work...

Many-mouse and tablet support
by Szymon Wilczek, mentored by Ryan C. Gordon

Everything concerning the project is noted on the wiki:
http://wilku.ravenlord.ws/doku.php?id=start

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403155
This commit is contained in:
Sam Lantinga 2008-08-25 06:33:00 +00:00
parent 95134b6d3c
commit e7d72614c3
22 changed files with 805 additions and 267 deletions

View file

@ -72,9 +72,11 @@ typedef enum
SDL_JOYBUTTONUP, /**< Joystick button released */
SDL_QUIT, /**< User-requested quit */
SDL_SYSWMEVENT, /**< System specific event */
SDL_PROXIMITYIN, /**< Proximity In event */
SDL_PROXIMITYOUT, /**< Proximity Out event */
SDL_EVENT_RESERVED1, /**< Reserved for future use... */
SDL_EVENT_RESERVED2, /**< Reserved for future use... */
SDL_EVENT_RESERVED3, /**< Reserved for future use... */
SDL_EVENT_RESERVED2,
SDL_EVENT_RESERVED3,
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
SDL_USEREVENT = 24,
/* This last event is only for bounding internal arrays
@ -112,7 +114,9 @@ typedef enum
SDL_EVENTMASK(SDL_JOYHATMOTION) |
SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT),
SDL_PROXIMITYINMASK = SDL_EVENTMASK(SDL_PROXIMITYIN),
SDL_PROXIMITYOUTMASK = SDL_EVENTMASK(SDL_PROXIMITYOUT)
} SDL_EventMask;
#define SDL_ALLEVENTS 0xFFFFFFFF
@ -170,6 +174,13 @@ typedef struct SDL_MouseMotionEvent
Uint8 state; /**< The current button state */
int x; /**< X coordinate, relative to window */
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 cursor; /**< The cursor being used in the event */
int xrel; /**< The relative motion in the X direction */
int yrel; /**< The relative motion in the Y direction */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
@ -316,6 +327,15 @@ typedef struct SDL_ResizeEvent
int h;
} SDL_ResizeEvent;
typedef struct SDL_ProximityEvent
{
Uint8 type;
Uint8 which;
int cursor;
int x;
int y;
} SDL_ProximityEvent;
/**
* \union SDL_Event
*
@ -337,6 +357,7 @@ typedef union SDL_Event
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_ProximityEvent proximity; /**< Proximity In or Out event */
/* Temporarily here for backwards compatibility */
SDL_ActiveEvent active;

View file

@ -242,7 +242,7 @@ enum
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
};
/**

View file

@ -72,7 +72,7 @@ extern DECLSPEC int SDLCALL SDL_SelectMouse(int index);
*
* \brief Get the window which currently has focus for the currently selected mouse.
*/
extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index);
/**
* \fn int SDL_SetRelativeMouseMode(SDL_bool enabled)
@ -92,7 +92,8 @@ extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
*
* \sa SDL_GetRelativeMouseMode()
*/
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index,
SDL_bool enabled);
/**
* \fn SDL_bool SDL_GetRelativeMouseMode()
@ -101,7 +102,7 @@ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
*
* \sa SDL_SetRelativeMouseMode()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index);
/**
* \fn Uint8 SDL_GetMouseState(int *x, int *y)
@ -113,7 +114,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
* mouse cursor position relative to the focus window for the currently
* selected mouse. You can pass NULL for either x or y.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int index, int *x, int *y);
/**
* \fn Uint8 SDL_GetRelativeMouseState(int *x, int *y)
@ -124,7 +125,8 @@ extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x,
int *y);
/**
* \fn void SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y)
@ -203,6 +205,16 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
Button 2: Middle mouse button
Button 3: Right mouse button
*/
/* FIXME: Where do these functions go in this header?
Also, add doxygen documentation for these...
*/
extern DECLSPEC char *SDLCALL SDL_GetMouseName(int index);
extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index);
extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index);
#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2