SDL  2.0
SDL_touch.c File Reference
#include "../SDL_internal.h"
#include "SDL_events.h"
#include "SDL_events_c.h"
#include "../video/SDL_sysvideo.h"
+ Include dependency graph for SDL_touch.c:

Go to the source code of this file.

Macros

#define SYNTHESIZE_TOUCH_TO_MOUSE   1
 

Functions

int SDL_TouchInit (void)
 
int SDL_GetNumTouchDevices (void)
 Get the number of registered touch devices. More...
 
SDL_TouchID SDL_GetTouchDevice (int index)
 Get the touch ID with the given index, or 0 if the index is invalid. More...
 
static int SDL_GetTouchIndex (SDL_TouchID id)
 
SDL_TouchSDL_GetTouch (SDL_TouchID id)
 
SDL_TouchDeviceType SDL_GetTouchDeviceType (SDL_TouchID id)
 Get the type of the given touch device. More...
 
static int SDL_GetFingerIndex (const SDL_Touch *touch, SDL_FingerID fingerid)
 
static SDL_FingerSDL_GetFinger (const SDL_Touch *touch, SDL_FingerID id)
 
int SDL_GetNumTouchFingers (SDL_TouchID touchID)
 Get the number of active fingers for a given touch device. More...
 
SDL_FingerSDL_GetTouchFinger (SDL_TouchID touchID, int index)
 Get the finger object of the given touch, with the given index. More...
 
int SDL_AddTouch (SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name)
 
static int SDL_AddFinger (SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
 
static int SDL_DelFinger (SDL_Touch *touch, SDL_FingerID fingerid)
 
int SDL_SendTouch (SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, SDL_bool down, float x, float y, float pressure)
 
int SDL_SendTouchMotion (SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, float x, float y, float pressure)
 
void SDL_DelTouch (SDL_TouchID id)
 
void SDL_TouchQuit (void)
 

Variables

static int SDL_num_touch = 0
 
static SDL_Touch ** SDL_touchDevices = NULL
 
static SDL_bool finger_touching = SDL_FALSE
 
static SDL_FingerID track_fingerid
 
static SDL_TouchID track_touchid
 

Macro Definition Documentation

◆ SYNTHESIZE_TOUCH_TO_MOUSE

#define SYNTHESIZE_TOUCH_TO_MOUSE   1

Definition at line 35 of file SDL_touch.c.

Function Documentation

◆ SDL_AddFinger()

static int SDL_AddFinger ( SDL_Touch touch,
SDL_FingerID  fingerid,
float  x,
float  y,
float  pressure 
)
static

Definition at line 197 of file SDL_touch.c.

198 {
199  SDL_Finger *finger;
200 
201  if (touch->num_fingers == touch->max_fingers) {
202  SDL_Finger **new_fingers;
203  new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers));
204  if (!new_fingers) {
205  return SDL_OutOfMemory();
206  }
207  touch->fingers = new_fingers;
208  touch->fingers[touch->max_fingers] = (SDL_Finger *)SDL_malloc(sizeof(*finger));
209  if (!touch->fingers[touch->max_fingers]) {
210  return SDL_OutOfMemory();
211  }
212  touch->max_fingers++;
213  }
214 
215  finger = touch->fingers[touch->num_fingers++];
216  finger->id = fingerid;
217  finger->x = x;
218  finger->y = y;
219  finger->pressure = pressure;
220  return 0;
221 }
#define SDL_malloc
#define SDL_realloc
#define SDL_OutOfMemory()
Definition: SDL_error.h:88
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
float y
Definition: SDL_touch.h:56
float pressure
Definition: SDL_touch.h:57
SDL_FingerID id
Definition: SDL_touch.h:54
float x
Definition: SDL_touch.h:55
int max_fingers
Definition: SDL_touch_c.h:32
SDL_Finger ** fingers
Definition: SDL_touch_c.h:33
int num_fingers
Definition: SDL_touch_c.h:31

References SDL_Touch::fingers, SDL_Finger::id, SDL_Touch::max_fingers, SDL_Touch::num_fingers, SDL_Finger::pressure, SDL_malloc, SDL_OutOfMemory, SDL_realloc, SDL_Finger::x, and SDL_Finger::y.

Referenced by SDL_SendTouch().

◆ SDL_AddTouch()

int SDL_AddTouch ( SDL_TouchID  touchID,
SDL_TouchDeviceType  type,
const char *  name 
)

Definition at line 154 of file SDL_touch.c.

155 {
156  SDL_Touch **touchDevices;
157  int index;
158 
159  index = SDL_GetTouchIndex(touchID);
160  if (index >= 0) {
161  return index;
162  }
163 
164  /* Add the touch to the list of touch */
165  touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices,
166  (SDL_num_touch + 1) * sizeof(*touchDevices));
167  if (!touchDevices) {
168  return SDL_OutOfMemory();
169  }
170 
171  SDL_touchDevices = touchDevices;
173 
175  if (!SDL_touchDevices[index]) {
176  return SDL_OutOfMemory();
177  }
178 
179  /* Added touch to list */
180  ++SDL_num_touch;
181 
182  /* we're setting the touch properties */
183  SDL_touchDevices[index]->id = touchID;
188 
189  /* Record this touch device for gestures */
190  /* We could do this on the fly in the gesture code if we wanted */
191  SDL_GestureAddTouch(touchID);
192 
193  return index;
194 }
int SDL_GestureAddTouch(SDL_TouchID touchId)
Definition: SDL_gesture.c:454
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
GLuint index
static SDL_Touch ** SDL_touchDevices
Definition: SDL_touch.c:31
static int SDL_GetTouchIndex(SDL_TouchID id)
Definition: SDL_touch.c:67
static int SDL_num_touch
Definition: SDL_touch.c:30
#define NULL
Definition: begin_code.h:163
SDL_TouchID id
Definition: SDL_touch_c.h:29
SDL_TouchDeviceType type
Definition: SDL_touch_c.h:30

References SDL_Touch::fingers, SDL_Touch::id, SDL_Touch::max_fingers, NULL, SDL_Touch::num_fingers, SDL_GestureAddTouch(), SDL_GetTouchIndex(), SDL_malloc, SDL_num_touch, SDL_OutOfMemory, SDL_realloc, SDL_touchDevices, and SDL_Touch::type.

Referenced by SDL_MouseTouchEventsChanged().

◆ SDL_DelFinger()

static int SDL_DelFinger ( SDL_Touch touch,
SDL_FingerID  fingerid 
)
static

Definition at line 224 of file SDL_touch.c.

225 {
226  SDL_Finger *temp;
227 
228  int index = SDL_GetFingerIndex(touch, fingerid);
229  if (index < 0) {
230  return -1;
231  }
232 
233  touch->num_fingers--;
234  temp = touch->fingers[index];
235  touch->fingers[index] = touch->fingers[touch->num_fingers];
236  touch->fingers[touch->num_fingers] = temp;
237  return 0;
238 }
static int SDL_GetFingerIndex(const SDL_Touch *touch, SDL_FingerID fingerid)
Definition: SDL_touch.c:108

References SDL_Touch::fingers, SDL_Touch::num_fingers, and SDL_GetFingerIndex().

Referenced by SDL_SendTouch().

◆ SDL_DelTouch()

void SDL_DelTouch ( SDL_TouchID  id)

Definition at line 440 of file SDL_touch.c.

441 {
442  int i;
443  int index = SDL_GetTouchIndex(id);
444  SDL_Touch *touch = SDL_GetTouch(id);
445 
446  if (!touch) {
447  return;
448  }
449 
450  for (i = 0; i < touch->max_fingers; ++i) {
451  SDL_free(touch->fingers[i]);
452  }
453  SDL_free(touch->fingers);
454  SDL_free(touch);
455 
456  SDL_num_touch--;
458 
459  /* Delete this touch device for gestures */
461 }
#define SDL_free
int SDL_GestureDelTouch(SDL_TouchID touchId)
Definition: SDL_gesture.c:472
SDL_Touch * SDL_GetTouch(SDL_TouchID id)
Definition: SDL_touch.c:82
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)
Definition: SDL_x11sym.h:50

References SDL_Touch::fingers, i, SDL_Touch::max_fingers, SDL_free, SDL_GestureDelTouch(), SDL_GetTouch(), SDL_GetTouchIndex(), SDL_num_touch, and SDL_touchDevices.

Referenced by SDL_TouchQuit().

◆ SDL_GetFinger()

static SDL_Finger* SDL_GetFinger ( const SDL_Touch touch,
SDL_FingerID  id 
)
static

Definition at line 120 of file SDL_touch.c.

121 {
122  int index = SDL_GetFingerIndex(touch, id);
123  if (index < 0 || index >= touch->num_fingers) {
124  return NULL;
125  }
126  return touch->fingers[index];
127 }

References SDL_Touch::fingers, NULL, SDL_Touch::num_fingers, and SDL_GetFingerIndex().

Referenced by SDL_SendTouch(), and SDL_SendTouchMotion().

◆ SDL_GetFingerIndex()

static int SDL_GetFingerIndex ( const SDL_Touch touch,
SDL_FingerID  fingerid 
)
static

Definition at line 108 of file SDL_touch.c.

109 {
110  int index;
111  for (index = 0; index < touch->num_fingers; ++index) {
112  if (touch->fingers[index]->id == fingerid) {
113  return index;
114  }
115  }
116  return -1;
117 }

References SDL_Touch::fingers, SDL_Finger::id, and SDL_Touch::num_fingers.

Referenced by SDL_DelFinger(), and SDL_GetFinger().

◆ SDL_GetNumTouchDevices()

int SDL_GetNumTouchDevices ( void  )

Get the number of registered touch devices.

Definition at line 51 of file SDL_touch.c.

52 {
53  return SDL_num_touch;
54 }

References SDL_num_touch.

◆ SDL_GetNumTouchFingers()

int SDL_GetNumTouchFingers ( SDL_TouchID  touchID)

Get the number of active fingers for a given touch device.

Definition at line 130 of file SDL_touch.c.

131 {
132  SDL_Touch *touch = SDL_GetTouch(touchID);
133  if (touch) {
134  return touch->num_fingers;
135  }
136  return 0;
137 }

References SDL_Touch::num_fingers, and SDL_GetTouch().

◆ SDL_GetTouch()

SDL_Touch* SDL_GetTouch ( SDL_TouchID  id)

Definition at line 82 of file SDL_touch.c.

83 {
84  int index = SDL_GetTouchIndex(id);
86  if (SDL_GetVideoDevice()->ResetTouch != NULL) {
87  SDL_SetError("Unknown touch id %d, resetting", (int) id);
89  } else {
90  SDL_SetError("Unknown touch device id %d, cannot reset", (int) id);
91  }
92  return NULL;
93  }
94  return SDL_touchDevices[index];
95 }
#define SDL_SetError
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:587
void(* ResetTouch)(_THIS)
Definition: SDL_sysvideo.h:173

References NULL, SDL_VideoDevice::ResetTouch, SDL_GetTouchIndex(), SDL_GetVideoDevice(), SDL_num_touch, SDL_SetError, and SDL_touchDevices.

Referenced by SDL_DelTouch(), SDL_GetNumTouchFingers(), SDL_GetTouchDeviceType(), SDL_GetTouchFinger(), SDL_SendTouch(), and SDL_SendTouchMotion().

◆ SDL_GetTouchDevice()

SDL_TouchID SDL_GetTouchDevice ( int  index)

Get the touch ID with the given index, or 0 if the index is invalid.

Definition at line 57 of file SDL_touch.c.

58 {
60  SDL_SetError("Unknown touch device index %d", index);
61  return 0;
62  }
63  return SDL_touchDevices[index]->id;
64 }

References SDL_Touch::id, SDL_num_touch, SDL_SetError, and SDL_touchDevices.

◆ SDL_GetTouchDeviceType()

SDL_TouchDeviceType SDL_GetTouchDeviceType ( SDL_TouchID  id)

Get the type of the given touch device.

Definition at line 98 of file SDL_touch.c.

99 {
100  SDL_Touch *touch = SDL_GetTouch(id);
101  if (touch) {
102  return touch->type;
103  }
105 }
@ SDL_TOUCH_DEVICE_INVALID
Definition: SDL_touch.h:46

References SDL_GetTouch(), SDL_TOUCH_DEVICE_INVALID, and SDL_Touch::type.

◆ SDL_GetTouchFinger()

SDL_Finger* SDL_GetTouchFinger ( SDL_TouchID  touchID,
int  index 
)

Get the finger object of the given touch, with the given index.

Definition at line 140 of file SDL_touch.c.

141 {
142  SDL_Touch *touch = SDL_GetTouch(touchID);
143  if (!touch) {
144  return NULL;
145  }
146  if (index < 0 || index >= touch->num_fingers) {
147  SDL_SetError("Unknown touch finger");
148  return NULL;
149  }
150  return touch->fingers[index];
151 }

References SDL_Touch::fingers, NULL, SDL_Touch::num_fingers, SDL_GetTouch(), and SDL_SetError.

◆ SDL_GetTouchIndex()

static int SDL_GetTouchIndex ( SDL_TouchID  id)
static

Definition at line 67 of file SDL_touch.c.

68 {
69  int index;
70  SDL_Touch *touch;
71 
72  for (index = 0; index < SDL_num_touch; ++index) {
73  touch = SDL_touchDevices[index];
74  if (touch->id == id) {
75  return index;
76  }
77  }
78  return -1;
79 }

References SDL_Touch::id, SDL_num_touch, and SDL_touchDevices.

Referenced by SDL_AddTouch(), SDL_DelTouch(), and SDL_GetTouch().

◆ SDL_SendTouch()

int SDL_SendTouch ( SDL_TouchID  id,
SDL_FingerID  fingerid,
SDL_Window window,
SDL_bool  down,
float  x,
float  y,
float  pressure 
)

Definition at line 241 of file SDL_touch.c.

243 {
244  int posted;
245  SDL_Finger *finger;
246  SDL_Mouse *mouse;
247 
248  SDL_Touch* touch = SDL_GetTouch(id);
249  if (!touch) {
250  return -1;
251  }
252 
253  mouse = SDL_GetMouse();
254 
255 #if SYNTHESIZE_TOUCH_TO_MOUSE
256  /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */
257  {
258  if (mouse->touch_mouse_events) {
259  /* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
260  if (id != SDL_MOUSE_TOUCHID) {
261  if (window) {
262  if (down) {
263  if (finger_touching == SDL_FALSE) {
264  int pos_x = (int)(x * (float)window->w);
265  int pos_y = (int)(y * (float)window->h);
266  if (pos_x < 0) pos_x = 0;
267  if (pos_x > window->w - 1) pos_x = window->w - 1;
268  if (pos_y < 0) pos_y = 0;
269  if (pos_y > window->h - 1) pos_y = window->h - 1;
270  SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
272  }
273  } else {
274  if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
276  }
277  }
278  }
279  if (down) {
280  if (finger_touching == SDL_FALSE) {
282  track_touchid = id;
283  track_fingerid = fingerid;
284  }
285  } else {
286  if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
288  }
289  }
290  }
291  }
292  }
293 #endif
294 
295  /* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */
296  if (mouse->mouse_touch_events == 0) {
297  if (id == SDL_MOUSE_TOUCHID) {
298  return 0;
299  }
300  }
301 
302  finger = SDL_GetFinger(touch, fingerid);
303  if (down) {
304  if (finger) {
305  /* This finger is already down */
306  return 0;
307  }
308 
309  if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) {
310  return 0;
311  }
312 
313  posted = 0;
316  event.tfinger.type = SDL_FINGERDOWN;
317  event.tfinger.touchId = id;
318  event.tfinger.fingerId = fingerid;
319  event.tfinger.x = x;
320  event.tfinger.y = y;
321  event.tfinger.dx = 0;
322  event.tfinger.dy = 0;
323  event.tfinger.pressure = pressure;
324  event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
325  posted = (SDL_PushEvent(&event) > 0);
326  }
327  } else {
328  if (!finger) {
329  /* This finger is already up */
330  return 0;
331  }
332 
333  posted = 0;
336  event.tfinger.type = SDL_FINGERUP;
337  event.tfinger.touchId = id;
338  event.tfinger.fingerId = fingerid;
339  /* I don't trust the coordinates passed on fingerUp */
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;
345  event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
346  posted = (SDL_PushEvent(&event) > 0);
347  }
348 
349  SDL_DelFinger(touch, fingerid);
350  }
351  return posted;
352 }
#define SDL_PushEvent
#define SDL_GetWindowID
@ SDL_FINGERUP
Definition: SDL_events.h:135
@ SDL_FINGERDOWN
Definition: SDL_events.h:134
#define SDL_GetEventState(type)
Definition: SDL_events.h:808
#define SDL_RELEASED
Definition: SDL_events.h:49
#define SDL_ENABLE
Definition: SDL_events.h:795
#define SDL_PRESSED
Definition: SDL_events.h:50
int SDL_SendMouseButton(SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
Definition: SDL_mouse.c:599
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:175
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
Definition: SDL_mouse.c:298
#define SDL_BUTTON_LEFT
Definition: SDL_mouse.h:282
struct _cl_event * event
GLuint id
@ SDL_TRUE
Definition: SDL_stdinc.h:170
@ SDL_FALSE
Definition: SDL_stdinc.h:169
static int SDL_DelFinger(SDL_Touch *touch, SDL_FingerID fingerid)
Definition: SDL_touch.c:224
static SDL_TouchID track_touchid
Definition: SDL_touch.c:40
static SDL_FingerID track_fingerid
Definition: SDL_touch.c:39
static int SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
Definition: SDL_touch.c:197
static SDL_bool finger_touching
Definition: SDL_touch.c:38
static SDL_Finger * SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id)
Definition: SDL_touch.c:120
#define SDL_MOUSE_TOUCHID
Definition: SDL_touch.h:64
#define SDL_TOUCH_MOUSEID
Definition: SDL_touch.h:61
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_bool touch_mouse_events
Definition: SDL_mouse_c.h:95
SDL_bool mouse_touch_events
Definition: SDL_mouse_c.h:96
General event structure.
Definition: SDL_events.h:592
typedef int(__stdcall *FARPROC)()

References finger_touching, int(), SDL_Mouse::mouse_touch_events, SDL_AddFinger(), SDL_BUTTON_LEFT, SDL_DelFinger(), SDL_ENABLE, SDL_FALSE, SDL_FINGERDOWN, SDL_FINGERUP, SDL_GetEventState, SDL_GetFinger(), SDL_GetMouse(), SDL_GetTouch(), SDL_GetWindowID, SDL_MOUSE_TOUCHID, SDL_PRESSED, SDL_PushEvent, SDL_RELEASED, SDL_SendMouseButton(), SDL_SendMouseMotion(), SDL_TOUCH_MOUSEID, SDL_TRUE, SDL_Mouse::touch_mouse_events, track_fingerid, track_touchid, SDL_Finger::x, and SDL_Finger::y.

Referenced by SDL_PrivateSendMouseButton(), and SDL_SendTouchMotion().

◆ SDL_SendTouchMotion()

int SDL_SendTouchMotion ( SDL_TouchID  id,
SDL_FingerID  fingerid,
SDL_Window window,
float  x,
float  y,
float  pressure 
)

Definition at line 355 of file SDL_touch.c.

357 {
358  SDL_Touch *touch;
359  SDL_Finger *finger;
360  SDL_Mouse *mouse;
361  int posted;
362  float xrel, yrel, prel;
363 
364  touch = SDL_GetTouch(id);
365  if (!touch) {
366  return -1;
367  }
368 
369  mouse = SDL_GetMouse();
370 
371 #if SYNTHESIZE_TOUCH_TO_MOUSE
372  /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */
373  {
374  if (mouse->touch_mouse_events) {
375  if (id != SDL_MOUSE_TOUCHID) {
376  if (window) {
377  if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
378  int pos_x = (int)(x * (float)window->w);
379  int pos_y = (int)(y * (float)window->h);
380  if (pos_x < 0) pos_x = 0;
381  if (pos_x > window->w - 1) pos_x = window->w - 1;
382  if (pos_y < 0) pos_y = 0;
383  if (pos_y > window->h - 1) pos_y = window->h - 1;
384  SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
385  }
386  }
387  }
388  }
389  }
390 #endif
391 
392  /* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */
393  if (mouse->mouse_touch_events == 0) {
394  if (id == SDL_MOUSE_TOUCHID) {
395  return 0;
396  }
397  }
398 
399  finger = SDL_GetFinger(touch,fingerid);
400  if (!finger) {
401  return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure);
402  }
403 
404  xrel = x - finger->x;
405  yrel = y - finger->y;
406  prel = pressure - finger->pressure;
407 
408  /* Drop events that don't change state */
409  if (xrel == 0.0f && yrel == 0.0f && prel == 0.0f) {
410 #if 0
411  printf("Touch event didn't change state - dropped!\n");
412 #endif
413  return 0;
414  }
415 
416  /* Update internal touch coordinates */
417  finger->x = x;
418  finger->y = y;
419  finger->pressure = pressure;
420 
421  /* Post the event, if desired */
422  posted = 0;
425  event.tfinger.type = SDL_FINGERMOTION;
426  event.tfinger.touchId = id;
427  event.tfinger.fingerId = fingerid;
428  event.tfinger.x = x;
429  event.tfinger.y = y;
430  event.tfinger.dx = xrel;
431  event.tfinger.dy = yrel;
432  event.tfinger.pressure = pressure;
433  event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
434  posted = (SDL_PushEvent(&event) > 0);
435  }
436  return posted;
437 }
@ SDL_FINGERMOTION
Definition: SDL_events.h:136
int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, SDL_bool down, float x, float y, float pressure)
Definition: SDL_touch.c:241

References finger_touching, int(), SDL_Mouse::mouse_touch_events, SDL_Finger::pressure, SDL_ENABLE, SDL_FINGERMOTION, SDL_GetEventState, SDL_GetFinger(), SDL_GetMouse(), SDL_GetTouch(), SDL_GetWindowID, SDL_MOUSE_TOUCHID, SDL_PushEvent, SDL_SendMouseMotion(), SDL_SendTouch(), SDL_TOUCH_MOUSEID, SDL_TRUE, SDL_Mouse::touch_mouse_events, track_fingerid, track_touchid, SDL_Finger::x, and SDL_Finger::y.

Referenced by SDL_PrivateSendMouseMotion().

◆ SDL_TouchInit()

int SDL_TouchInit ( void  )

Definition at line 45 of file SDL_touch.c.

46 {
47  return (0);
48 }

Referenced by SDL_VideoInit().

◆ SDL_TouchQuit()

void SDL_TouchQuit ( void  )

Definition at line 464 of file SDL_touch.c.

465 {
466  int i;
467 
468  for (i = SDL_num_touch; i--; ) {
470  }
472 
475  SDL_GestureQuit();
476 }
#define SDL_assert(condition)
Definition: SDL_assert.h:171
void SDL_GestureQuit()
Definition: SDL_gesture.c:106
void SDL_DelTouch(SDL_TouchID id)
Definition: SDL_touch.c:440

References i, NULL, SDL_assert, SDL_DelTouch(), SDL_free, SDL_GestureQuit(), SDL_num_touch, and SDL_touchDevices.

Referenced by SDL_VideoQuit().

Variable Documentation

◆ finger_touching

SDL_bool finger_touching = SDL_FALSE
static

Definition at line 38 of file SDL_touch.c.

Referenced by SDL_SendTouch(), and SDL_SendTouchMotion().

◆ SDL_num_touch

◆ SDL_touchDevices

SDL_Touch** SDL_touchDevices = NULL
static

◆ track_fingerid

SDL_FingerID track_fingerid
static

Definition at line 39 of file SDL_touch.c.

Referenced by SDL_SendTouch(), and SDL_SendTouchMotion().

◆ track_touchid

SDL_TouchID track_touchid
static

Definition at line 40 of file SDL_touch.c.

Referenced by SDL_SendTouch(), and SDL_SendTouchMotion().