21 #include "../SDL_internal.h"
27 #include "../video/SDL_sysvideo.h"
35 #define SYNTHESIZE_TOUCH_TO_MOUSE 1
37 #if SYNTHESIZE_TOUCH_TO_MOUSE
74 if (touch->
id ==
id) {
87 SDL_SetError(
"Unknown touch id %d, resetting", (
int)
id);
90 SDL_SetError(
"Unknown touch device id %d, cannot reset", (
int)
id);
216 finger->
id = fingerid;
242 SDL_bool down,
float x,
float y,
float pressure)
255 #if SYNTHESIZE_TOUCH_TO_MOUSE
266 if (pos_x < 0) pos_x = 0;
268 if (pos_y < 0) pos_y = 0;
317 event.tfinger.touchId =
id;
318 event.tfinger.fingerId = fingerid;
321 event.tfinger.dx = 0;
322 event.tfinger.dy = 0;
323 event.tfinger.pressure = pressure;
337 event.tfinger.touchId =
id;
338 event.tfinger.fingerId = fingerid;
340 event.tfinger.x = finger->
x;
341 event.tfinger.y = finger->
y;
342 event.tfinger.dx = 0;
343 event.tfinger.dy = 0;
344 event.tfinger.pressure = pressure;
356 float x,
float y,
float pressure)
362 float xrel, yrel, prel;
371 #if SYNTHESIZE_TOUCH_TO_MOUSE
380 if (pos_x < 0) pos_x = 0;
382 if (pos_y < 0) pos_y = 0;
404 xrel =
x - finger->
x;
405 yrel =
y - finger->
y;
409 if (xrel == 0.0f && yrel == 0.0f && prel == 0.0f) {
411 printf(
"Touch event didn't change state - dropped!\n");
426 event.tfinger.touchId =
id;
427 event.tfinger.fingerId = fingerid;
430 event.tfinger.dx = xrel;
431 event.tfinger.dy = yrel;
432 event.tfinger.pressure = pressure;
#define SDL_assert(condition)
#define SDL_OutOfMemory()
#define SDL_GetEventState(type)
int SDL_GestureAddTouch(SDL_TouchID touchId)
int SDL_GestureDelTouch(SDL_TouchID touchId)
int SDL_SendMouseButton(SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
SDL_Mouse * SDL_GetMouse(void)
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
GLint GLint GLint GLint GLint GLint y
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLuint const GLchar * name
SDL_VideoDevice * SDL_GetVideoDevice(void)
static int SDL_DelFinger(SDL_Touch *touch, SDL_FingerID fingerid)
SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID id)
Get the type of the given touch device.
int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, SDL_bool down, float x, float y, float pressure)
void SDL_DelTouch(SDL_TouchID id)
static SDL_TouchID track_touchid
int SDL_GetNumTouchDevices(void)
Get the number of registered touch devices.
SDL_Touch * SDL_GetTouch(SDL_TouchID id)
static SDL_Touch ** SDL_touchDevices
static int SDL_GetTouchIndex(SDL_TouchID id)
SDL_TouchID SDL_GetTouchDevice(int index)
Get the touch ID with the given index, or 0 if the index is invalid.
static int SDL_GetFingerIndex(const SDL_Touch *touch, SDL_FingerID fingerid)
SDL_Finger * SDL_GetTouchFinger(SDL_TouchID touchID, int index)
Get the finger object of the given touch, with the given index.
static SDL_FingerID track_fingerid
int SDL_GetNumTouchFingers(SDL_TouchID touchID)
Get the number of active fingers for a given touch device.
static int SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
static SDL_bool finger_touching
int SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name)
static SDL_Finger * SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id)
int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, float x, float y, float pressure)
#define SDL_MOUSE_TOUCHID
@ SDL_TOUCH_DEVICE_INVALID
#define SDL_TOUCH_MOUSEID
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
EGLSurface EGLNativeWindowType * window
SDL_bool touch_mouse_events
SDL_bool mouse_touch_events
void(* ResetTouch)(_THIS)
The type used to identify a window.
typedef int(__stdcall *FARPROC)()