Commit f806d397 authored by Jim Grandpre's avatar Jim Grandpre

Added touch event definitions. Heavily modified events/SDL_touch*.

parent 27ad25a0
...@@ -86,11 +86,19 @@ typedef enum ...@@ -86,11 +86,19 @@ typedef enum
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
SDL_JOYBUTTONUP, /**< Joystick button released */ SDL_JOYBUTTONUP, /**< Joystick button released */
/*Touch events - is 0x700 the correct place?*/
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_TOUCHBUTTONDOWN,
SDL_TOUCHBUTTONUP,
/* Obsolete events */ /* Obsolete events */
SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */ SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
SDL_EVENT_COMPAT2, SDL_EVENT_COMPAT2,
SDL_EVENT_COMPAT3, SDL_EVENT_COMPAT3,
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents() * and should be allocated with SDL_RegisterEvents()
*/ */
...@@ -289,6 +297,37 @@ typedef struct SDL_JoyButtonEvent ...@@ -289,6 +297,37 @@ typedef struct SDL_JoyButtonEvent
Uint8 padding1; Uint8 padding1;
} SDL_JoyButtonEvent; } SDL_JoyButtonEvent;
/**
* \brief Touch finger motion/finger event structure (event.tmotion.*)
*/
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION OR
SDL_FINGERDOWN OR SDL_FINGERUP*/
Uint32 windowID; /**< The window with mouse focus, if any */
Uint8 touchId; /**< The touch device id */
Uint8 state; /**< The current button state */
Uint8 fingerId;
Uint8 padding1;
} SDL_TouchFingerEvent;
/**
* \brief Touch finger motion/finger event structure (event.tmotion.*)
*/
typedef struct SDL_TouchButtonEvent
{
Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
Uint32 windowID; /**< The window with mouse focus, if any */
Uint8 touchId; /**< The touch device index */
Uint8 state; /**< The current button state */
Uint8 button; /**< The button changing state */
Uint8 padding1;
} SDL_TouchButtonEvent;
/** /**
* \brief The "quit requested" event * \brief The "quit requested" event
*/ */
...@@ -372,6 +411,8 @@ typedef union SDL_Event ...@@ -372,6 +411,8 @@ typedef union SDL_Event
SDL_UserEvent user; /**< Custom event data */ SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_ProximityEvent proximity; /**< Proximity In or Out event */ SDL_ProximityEvent proximity; /**< Proximity In or Out event */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_TouchButtonEvent tbutton; /**< Touch button event data */
/** Temporarily here for backwards compatibility */ /** Temporarily here for backwards compatibility */
/*@{*/ /*@{*/
......
This diff is collapsed.
...@@ -25,50 +25,51 @@ ...@@ -25,50 +25,51 @@
#define _SDL_touch_c_h #define _SDL_touch_c_h
typedef struct SDL_Touch SDL_Touch; typedef struct SDL_Touch SDL_Touch;
typedef struct SDL_Finger SDL_Finger;
struct SDL_Finger {
int id;
int x;
int y;
int z; /* for future use */
int xdelta;
int ydelta;
int last_x, last_y; /* the last reported x and y coordinates */
int pressure;
};
struct SDL_Touch struct SDL_Touch
{ {
/* Warp the touch to (x,y) */
void (*WarpTouch) (SDL_Touch * touch, SDL_Window * window, int x,
int y);
/* Free the touch when it's time */ /* Free the touch when it's time */
void (*FreeTouch) (SDL_Touch * touch); void (*FreeTouch) (SDL_Touch * touch);
/* data common for tablets */ /* data common for tablets */
int pressure;
int pressure_max; int pressure_max;
int pressure_min; int pressure_min;
int tilt; /* for future use */ int tilt; /* for future use */
int rotation; /* for future use */ int rotation; /* for future use */
int total_ends; int total_ends;
int current_end; int current_end;
/* Data common to all touch */ /* Data common to all touch */
int id; int id;
SDL_Window *focus; SDL_Window *focus;
int which;
int x;
int y;
int z; /* for future use */
int xdelta;
int ydelta;
int last_x, last_y; /* the last reported x and y coordinates */
char *name; char *name;
Uint8 buttonstate; Uint8 buttonstate;
SDL_bool relative_mode; SDL_bool relative_mode;
SDL_bool proximity;
SDL_bool flush_motion; SDL_bool flush_motion;
SDL_Cursor *cursors; int num_fingers;
SDL_Cursor *def_cursor; SDL_Finger** fingers;
SDL_Cursor *cur_cursor;
SDL_bool cursor_shown;
void *driverdata; void *driverdata;
}; };
/* Initialize the touch subsystem */ /* Initialize the touch subsystem */
extern int SDL_TouchInit(void); extern int SDL_TouchInit(void);
...@@ -84,24 +85,16 @@ extern int SDL_AddTouch(const SDL_Touch * touch, char *name, ...@@ -84,24 +85,16 @@ extern int SDL_AddTouch(const SDL_Touch * touch, char *name,
/* Remove a touch at an index, clearing the slot for later */ /* Remove a touch at an index, clearing the slot for later */
extern void SDL_DelTouch(int index); extern void SDL_DelTouch(int index);
/* Clear the button state of a touch at an index */
extern void SDL_ResetTouch(int index);
/* Set the touch focus window */ /* Set the touch focus window */
extern void SDL_SetTouchFocus(int id, SDL_Window * window); extern void SDL_SetTouchFocus(int id, SDL_Window * window);
/* Send a touch motion event for a touch */ /* Send a touch motion event for a touch */
extern int SDL_SendTouchMotion(int id, int relative, int x, int y, int z); extern int SDL_SendTouchMotion(int id, int fingerid,
int relative, int x, int y, int z);
/* Send a touch button event for a touch */ /* Send a touch button event for a touch */
extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button); extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
/* Send a touch wheel event for a touch */
extern int SDL_SendTouchWheel(int id, int x, int y);
/* Send a proximity event for a touch */
extern int SDL_SendProximity(int id, int x, int y, int type);
/* Shutdown the touch subsystem */ /* Shutdown the touch subsystem */
extern void SDL_TouchQuit(void); extern void SDL_TouchQuit(void);
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment