Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
authorjimtla
Sat, 31 Jul 2010 20:02:54 +0400
changeset 4678f8431f66613d
parent 4677 31607094315c
child 4679 5ee96ba0c01e
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
include/SDL_events.h
include/SDL_gesture.h
include/SDL_touch.h
src/events/SDL_gesture.c
src/events/SDL_gesture_c.h
src/events/SDL_touch.c
src/events/SDL_touch_c.h
src/video/cocoa/SDL_cocoawindow.m
src/video/uikit/SDL_uikitview.m
src/video/x11/SDL_eventtouch.c
touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/main.c
     1.1 --- a/include/SDL_events.h	Sat Jul 31 01:24:50 2010 +0400
     1.2 +++ b/include/SDL_events.h	Sat Jul 31 20:02:54 2010 +0400
     1.3 @@ -288,15 +288,15 @@
     1.4      Uint32 type;        /**< ::SDL_FINGERMOTION OR 
     1.5  			   SDL_FINGERDOWN OR SDL_FINGERUP*/
     1.6      Uint32 windowID;    /**< The window with mouse focus, if any */
     1.7 -    long touchId;        /**< The touch device id */
     1.8 -    long fingerId;
     1.9 +    SDL_TouchID touchId;        /**< The touch device id */
    1.10 +    SDL_FingerID fingerId;
    1.11      Uint8 state;        /**< The current button state */
    1.12      Uint8 padding1;
    1.13      Uint8 padding2;
    1.14      Uint8 padding3;
    1.15 -    float x;
    1.16 -    float y;
    1.17 -    int pressure;
    1.18 +    Uint16 x;
    1.19 +    Uint16 y;
    1.20 +    Uint16 pressure;
    1.21  } SDL_TouchFingerEvent;
    1.22  
    1.23  
    1.24 @@ -307,7 +307,7 @@
    1.25  {
    1.26      Uint32 type;        /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
    1.27      Uint32 windowID;    /**< The window with mouse focus, if any */
    1.28 -    long touchId;        /**< The touch device index */
    1.29 +    SDL_TouchID touchId;        /**< The touch device index */
    1.30      Uint8 state;        /**< The current button state */
    1.31      Uint8 button;        /**< The button changing state */
    1.32      Uint8 padding1;
    1.33 @@ -323,7 +323,7 @@
    1.34  {
    1.35      Uint32 type;        /**< ::SDL_MULTIGESTURE */
    1.36      Uint32 windowID;    /**< The window with mouse focus, if any */
    1.37 -    long touchId;        /**< The touch device index */
    1.38 +    SDL_TouchID touchId;        /**< The touch device index */
    1.39      float dTheta;
    1.40      float dDist;
    1.41      float x;  //currently 0...1. Change to screen coords?
    1.42 @@ -335,8 +335,8 @@
    1.43  {
    1.44      Uint32 type;        /**< ::SDL_DOLLARGESTURE */
    1.45      Uint32 windowID;    /**< The window with mouse focus, if any */
    1.46 -    long touchId;        /**< The touch device index */
    1.47 -    unsigned long gestureId;
    1.48 +    SDL_TouchID touchId;        /**< The touch device index */
    1.49 +    SDL_GestureID gestureId;
    1.50      float error;
    1.51    /*
    1.52      //TODO: Enable to give location?
     2.1 --- a/include/SDL_gesture.h	Sat Jul 31 01:24:50 2010 +0400
     2.2 +++ b/include/SDL_gesture.h	Sat Jul 31 20:02:54 2010 +0400
     2.3 @@ -33,6 +33,9 @@
     2.4  #include "SDL_error.h"
     2.5  #include "SDL_video.h"
     2.6  
     2.7 +#include "SDL_touch.h"
     2.8 +
     2.9 +
    2.10  #include "begin_code.h"
    2.11  /* Set up for C function definitions, even when using C++ */
    2.12  #ifdef __cplusplus
    2.13 @@ -41,6 +44,7 @@
    2.14  /* *INDENT-ON* */
    2.15  #endif
    2.16  
    2.17 +  typedef Uint64 SDL_GestureID;
    2.18  
    2.19  /* Function prototypes */
    2.20  
    2.21 @@ -49,7 +53,7 @@
    2.22   *
    2.23   *
    2.24   */
    2.25 -  extern DECLSPEC int SDLCALL SDL_RecordGesture(int touchId);
    2.26 +  extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
    2.27  
    2.28  
    2.29  /**
    2.30 @@ -65,7 +69,7 @@
    2.31   *
    2.32   */
    2.33    extern DECLSPEC int 
    2.34 -  SDLCALL SDL_SaveDollarTemplate(unsigned long gestureId,SDL_RWops *src);
    2.35 +  SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
    2.36  
    2.37  
    2.38  /**
    2.39 @@ -73,7 +77,8 @@
    2.40   *
    2.41   *
    2.42   */
    2.43 -  extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(int touchId, SDL_RWops *src);
    2.44 +  extern DECLSPEC 
    2.45 +  int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
    2.46  
    2.47  
    2.48  
     3.1 --- a/include/SDL_touch.h	Sat Jul 31 01:24:50 2010 +0400
     3.2 +++ b/include/SDL_touch.h	Sat Jul 31 20:02:54 2010 +0400
     3.3 @@ -42,15 +42,19 @@
     3.4  #endif
     3.5  
     3.6  
     3.7 +typedef Uint64 SDL_TouchID;
     3.8 +typedef Uint64 SDL_FingerID;
     3.9 +
    3.10 +
    3.11  struct SDL_Finger {
    3.12 -  long id;
    3.13 -  float x;
    3.14 -  float y;
    3.15 -  float xdelta;
    3.16 -  float ydelta;
    3.17 -  float last_x, last_y,last_pressure;  /* the last reported coordinates */
    3.18 +  SDL_FingerID id;
    3.19 +  Uint16 x;
    3.20 +  Uint16 y;
    3.21 +  Uint16 xdelta;
    3.22 +  Uint16 ydelta;
    3.23 +  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
    3.24    SDL_bool down;
    3.25 -  float pressure;
    3.26 +  Uint16 pressure;
    3.27  };
    3.28  
    3.29  typedef struct SDL_Touch SDL_Touch;
    3.30 @@ -66,12 +70,13 @@
    3.31    float pressure_max, pressure_min;
    3.32    float x_max,x_min;
    3.33    float y_max,y_min;
    3.34 -  float xres,yres,pressureres;
    3.35 +  Uint16 xres,yres,pressureres;
    3.36 +  float native_xres,native_yres,native_pressureres;
    3.37    float tilt;                   /* for future use */
    3.38    float rotation;               /* for future use */
    3.39    
    3.40    /* Data common to all touch */
    3.41 -  long id;
    3.42 +  SDL_TouchID id;
    3.43    SDL_Window *focus;
    3.44    
    3.45    char *name;
    3.46 @@ -95,7 +100,7 @@
    3.47   *
    3.48   *
    3.49   */
    3.50 -  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(long id);
    3.51 +  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
    3.52  
    3.53  
    3.54  
    3.55 @@ -104,7 +109,8 @@
    3.56   *
    3.57   *
    3.58   */
    3.59 -  extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, long id);
    3.60 +  extern 
    3.61 +  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
    3.62  
    3.63  /* Ends C function definitions when using C++ */
    3.64  #ifdef __cplusplus
     4.1 --- a/src/events/SDL_gesture.c	Sat Jul 31 01:24:50 2010 +0400
     4.2 +++ b/src/events/SDL_gesture.c	Sat Jul 31 20:02:54 2010 +0400
     4.3 @@ -46,7 +46,7 @@
     4.4  typedef struct {
     4.5    Point p;
     4.6    float pressure;
     4.7 -  int id;
     4.8 +  SDL_FingerID id;
     4.9  } Finger;
    4.10  
    4.11  
    4.12 @@ -71,7 +71,7 @@
    4.13  } DollarTemplate;
    4.14  
    4.15  typedef struct {
    4.16 -  int id;
    4.17 +  SDL_GestureID id;
    4.18    Point res;
    4.19    Point centroid;
    4.20    TouchPoint gestureLast[MAXFINGERS];
    4.21 @@ -87,7 +87,7 @@
    4.22  int numGestureTouches = 0;
    4.23  SDL_bool recordAll;
    4.24  
    4.25 -int SDL_RecordGesture(int touchId) {
    4.26 +int SDL_RecordGesture(SDL_TouchID touchId) {
    4.27    int i;
    4.28    if(touchId < 0) recordAll = SDL_TRUE;
    4.29    for(i = 0;i < numGestureTouches; i++) {
    4.30 @@ -143,7 +143,7 @@
    4.31    return rtrn;  
    4.32  }
    4.33  
    4.34 -int SDL_SaveDollarTemplate(unsigned long gestureId, SDL_RWops *src) {
    4.35 +int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) {
    4.36    int i,j;
    4.37    for(i = 0; i < numGestureTouches; i++) {
    4.38      GestureTouch* touch = &gestureTouch[i];
    4.39 @@ -185,7 +185,7 @@
    4.40    return -1;
    4.41  }
    4.42  
    4.43 -int SDL_LoadDollarTemplates(int touchId, SDL_RWops *src) {
    4.44 +int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
    4.45    if(src == NULL) return 0;
    4.46    int i,loaded = 0;
    4.47    GestureTouch *touch = NULL;
    4.48 @@ -394,7 +394,7 @@
    4.49    return 0;
    4.50  }
    4.51  
    4.52 -GestureTouch * SDL_GetGestureTouch(int id) {
    4.53 +GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
    4.54    int i;
    4.55    for(i = 0;i < numGestureTouches; i++) {
    4.56      //printf("%i ?= %i\n",gestureTouch[i].id,id);
    4.57 @@ -414,7 +414,8 @@
    4.58    return SDL_PushEvent(&event) > 0;
    4.59  }
    4.60  
    4.61 -int SDL_SendGestureDollar(GestureTouch* touch,int gestureId,float error) {
    4.62 +int SDL_SendGestureDollar(GestureTouch* touch,
    4.63 +			  SDL_GestureID gestureId,float error) {
    4.64    SDL_Event event;
    4.65    event.dgesture.type = SDL_DOLLARGESTURE;
    4.66    event.dgesture.touchId = touch->id;
    4.67 @@ -429,7 +430,7 @@
    4.68  }
    4.69  
    4.70  
    4.71 -int SDL_SendDollarRecord(GestureTouch* touch,int gestureId) {
    4.72 +int SDL_SendDollarRecord(GestureTouch* touch,SDL_GestureID gestureId) {
    4.73    SDL_Event event;
    4.74    event.dgesture.type = SDL_DOLLARRECORD;
    4.75    event.dgesture.touchId = touch->id;
    4.76 @@ -489,7 +490,7 @@
    4.77  				  &bestTempl,inTouch);
    4.78  	  if(bestTempl >= 0){
    4.79  	    //Send Event
    4.80 -	    int gestureId = inTouch->dollarTemplate[bestTempl].hash;
    4.81 +	    unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
    4.82  	    SDL_SendGestureDollar(inTouch,gestureId,error);
    4.83  	    printf("Dollar error: %f\n",error);
    4.84  	  }
     5.1 --- a/src/events/SDL_gesture_c.h	Sat Jul 31 01:24:50 2010 +0400
     5.2 +++ b/src/events/SDL_gesture_c.h	Sat Jul 31 20:02:54 2010 +0400
     5.3 @@ -26,7 +26,7 @@
     5.4  
     5.5  extern void SDL_GestureProcessEvent(SDL_Event* event);
     5.6  
     5.7 -extern int SDL_RecordGesture(int touchId);
     5.8 +extern int SDL_RecordGesture(SDL_TouchID touchId);
     5.9  
    5.10  extern int SDL_GestureAddTouch(SDL_Touch* touch);
    5.11  
     6.1 --- a/src/events/SDL_touch.c	Sat Jul 31 01:24:50 2010 +0400
     6.2 +++ b/src/events/SDL_touch.c	Sat Jul 31 20:02:54 2010 +0400
     6.3 @@ -42,7 +42,7 @@
     6.4  }
     6.5  
     6.6  SDL_Touch *
     6.7 -SDL_GetTouch(long id)
     6.8 +SDL_GetTouch(SDL_TouchID id)
     6.9  {
    6.10      int index = SDL_GetTouchIndexId(id);
    6.11      if (index < 0 || index >= SDL_num_touch) {
    6.12 @@ -61,7 +61,7 @@
    6.13  }
    6.14  
    6.15  int
    6.16 -SDL_GetFingerIndexId(SDL_Touch* touch,long fingerid)
    6.17 +SDL_GetFingerIndexId(SDL_Touch* touch,SDL_FingerID fingerid)
    6.18  {
    6.19      int i;
    6.20      for(i = 0;i < touch->num_fingers;i++)
    6.21 @@ -72,7 +72,7 @@
    6.22  
    6.23  
    6.24  SDL_Finger *
    6.25 -SDL_GetFinger(SDL_Touch* touch,long id)
    6.26 +SDL_GetFinger(SDL_Touch* touch,SDL_FingerID id)
    6.27  {
    6.28      int index = SDL_GetFingerIndexId(touch,id);
    6.29      if(index < 0 || index >= touch->num_fingers)
    6.30 @@ -82,7 +82,7 @@
    6.31  
    6.32  
    6.33  int
    6.34 -SDL_GetTouchIndexId(long id)
    6.35 +SDL_GetTouchIndexId(SDL_TouchID id)
    6.36  {
    6.37      int index;
    6.38      SDL_Touch *touch;
    6.39 @@ -139,6 +139,8 @@
    6.40      SDL_touchPads[index]->relative_mode = SDL_FALSE;
    6.41      SDL_touchPads[index]->flush_motion = SDL_FALSE;
    6.42      
    6.43 +    SDL_touchPads[index]->xres = (1<<(16-1));
    6.44 +    SDL_touchPads[index]->yres = (1<<(16-1));
    6.45      //Do I want this here? Probably
    6.46      SDL_GestureAddTouch(SDL_touchPads[index]);
    6.47  
    6.48 @@ -146,7 +148,7 @@
    6.49  }
    6.50  
    6.51  void
    6.52 -SDL_DelTouch(long id)
    6.53 +SDL_DelTouch(SDL_TouchID id)
    6.54  {
    6.55      int index = SDL_GetTouchIndexId(id);
    6.56      SDL_Touch *touch = SDL_GetTouch(id);
    6.57 @@ -189,7 +191,7 @@
    6.58      return SDL_num_touch;
    6.59  }
    6.60  SDL_Window *
    6.61 -SDL_GetTouchFocusWindow(long id)
    6.62 +SDL_GetTouchFocusWindow(SDL_TouchID id)
    6.63  {
    6.64      SDL_Touch *touch = SDL_GetTouch(id);
    6.65  
    6.66 @@ -200,7 +202,7 @@
    6.67  }
    6.68  
    6.69  void
    6.70 -SDL_SetTouchFocus(long id, SDL_Window * window)
    6.71 +SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window)
    6.72  {
    6.73      int index = SDL_GetTouchIndexId(id);
    6.74      SDL_Touch *touch = SDL_GetTouch(id);
    6.75 @@ -250,12 +252,12 @@
    6.76  }
    6.77  
    6.78  int 
    6.79 -SDL_AddFinger(SDL_Touch* touch,SDL_Finger finger)
    6.80 +SDL_AddFinger(SDL_Touch* touch,SDL_Finger *finger)
    6.81  {
    6.82      int index;
    6.83      SDL_Finger **fingers;
    6.84      //printf("Adding Finger...\n");
    6.85 -    if (SDL_GetFingerIndexId(touch,finger.id) != -1) {
    6.86 +    if (SDL_GetFingerIndexId(touch,finger->id) != -1) {
    6.87          SDL_SetError("Finger ID already in use");
    6.88  	}
    6.89  
    6.90 @@ -282,14 +284,14 @@
    6.91          SDL_OutOfMemory();
    6.92          return -1;
    6.93      }
    6.94 -    *(touch->fingers[index]) = finger;
    6.95 +    *(touch->fingers[index]) = *finger;
    6.96      touch->num_fingers++;
    6.97  
    6.98      return index;
    6.99  }
   6.100  
   6.101  int
   6.102 -SDL_DelFinger(SDL_Touch* touch,long fingerid)
   6.103 +SDL_DelFinger(SDL_Touch* touch,SDL_FingerID fingerid)
   6.104  {
   6.105      int index = SDL_GetFingerIndexId(touch,fingerid);
   6.106      SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
   6.107 @@ -307,7 +309,8 @@
   6.108  
   6.109  
   6.110  int
   6.111 -SDL_SendFingerDown(long id, long fingerid, SDL_bool down, float x, float y, float pressure)
   6.112 +SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, 
   6.113 +		   float xin, float yin, float pressurein)
   6.114  {
   6.115      int posted;
   6.116      SDL_Touch* touch = SDL_GetTouch(id);
   6.117 @@ -315,11 +318,15 @@
   6.118      if(!touch) {
   6.119        return SDL_TouchNotFoundError(id);
   6.120      }
   6.121 -
   6.122 +    //scale to Integer coordinates
   6.123 +    Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
   6.124 +    Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
   6.125 +	Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
   6.126      if(down) {
   6.127  	SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
   6.128 +	SDL_Finger nf;
   6.129  	if(finger == NULL) {
   6.130 -	    SDL_Finger nf;
   6.131 +	    
   6.132  	    nf.id = fingerid;
   6.133  	    nf.x = x;
   6.134  	    nf.y = y;
   6.135 @@ -330,11 +337,11 @@
   6.136  	    nf.last_y = y;
   6.137  	    nf.last_pressure = pressure;
   6.138  	    nf.down = SDL_FALSE;
   6.139 -	    SDL_AddFinger(touch,nf);
   6.140 +	    SDL_AddFinger(touch,&nf);
   6.141  	    finger = &nf;
   6.142  	}
   6.143  	else if(finger->down) return 0;
   6.144 -	if(x < 0 || y < 0) return 0; //should defer if only a partial input
   6.145 +	if(xin < touch->x_min || yin < touch->y_min) return 0; //should defer if only a partial input
   6.146  	posted = 0;
   6.147  	if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
   6.148  	    SDL_Event event;
   6.149 @@ -367,8 +374,8 @@
   6.150  }
   6.151  
   6.152  int
   6.153 -SDL_SendTouchMotion(long id, long fingerid, int relative, 
   6.154 -		    float x, float y, float pressure)
   6.155 +SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative, 
   6.156 +		    float xin, float yin, float pressurein)
   6.157  {
   6.158      int index = SDL_GetTouchIndexId(id);
   6.159      SDL_Touch *touch = SDL_GetTouch(id);
   6.160 @@ -381,6 +388,12 @@
   6.161      if (!touch) {
   6.162        return SDL_TouchNotFoundError(id);
   6.163      }
   6.164 +
   6.165 +    //scale to Integer coordinates
   6.166 +    Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
   6.167 +    Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
   6.168 +	Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
   6.169 +	printf("(%f,%f) --> (%i,%i)",xin,yin,x,y);
   6.170      if(touch->flush_motion) {
   6.171  	return 0;
   6.172      }
   6.173 @@ -395,9 +408,9 @@
   6.174  	    x = (finger->last_x + x);
   6.175  	    y = (finger->last_y + y);
   6.176  	} else {
   6.177 -	    if(x < 0) x = finger->last_x; /*If movement is only in one axis,*/
   6.178 -	    if(y < 0) y = finger->last_y; /*The other is marked as -1*/
   6.179 -	    if(pressure < 0) pressure = finger->last_pressure;
   6.180 +	    if(xin < touch->x_min) x = finger->last_x; /*If movement is only in one axis,*/
   6.181 +	    if(yin < touch->y_min) y = finger->last_y; /*The other is marked as -1*/
   6.182 +	    if(pressurein < touch->pressure_min) pressure = finger->last_pressure;
   6.183  	    xrel = x - finger->last_x;
   6.184  	    yrel = y - finger->last_y;
   6.185  	}
   6.186 @@ -448,6 +461,7 @@
   6.187  	    event.tfinger.fingerId = fingerid;
   6.188  	    event.tfinger.x = x;
   6.189  	    event.tfinger.y = y;
   6.190 +		
   6.191  	    event.tfinger.pressure = pressure;
   6.192  	    event.tfinger.state = touch->buttonstate;
   6.193  	    event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
   6.194 @@ -460,7 +474,7 @@
   6.195      }
   6.196  }
   6.197  int
   6.198 -SDL_SendTouchButton(long id, Uint8 state, Uint8 button)
   6.199 +SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button)
   6.200  {
   6.201      SDL_Touch *touch = SDL_GetTouch(id);
   6.202      int posted;
   6.203 @@ -509,7 +523,7 @@
   6.204  }
   6.205  
   6.206  char *
   6.207 -SDL_GetTouchName(long id)
   6.208 +SDL_GetTouchName(SDL_TouchID id)
   6.209  {
   6.210      SDL_Touch *touch = SDL_GetTouch(id);
   6.211      if (!touch) {
   6.212 @@ -518,7 +532,7 @@
   6.213      return touch->name;
   6.214  }
   6.215  
   6.216 -int SDL_TouchNotFoundError(long id) {
   6.217 +int SDL_TouchNotFoundError(SDL_TouchID id) {
   6.218    printf("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id);
   6.219    printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
   6.220    int i;
     7.1 --- a/src/events/SDL_touch_c.h	Sat Jul 31 01:24:50 2010 +0400
     7.2 +++ b/src/events/SDL_touch_c.h	Sat Jul 31 20:02:54 2010 +0400
     7.3 @@ -34,13 +34,13 @@
     7.4  extern SDL_Touch *SDL_GetTouchIndex(int index);
     7.5  
     7.6  /* Get the touch with id = id */
     7.7 -extern SDL_Touch *SDL_GetTouch(long id);
     7.8 +extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
     7.9  
    7.10  /*Get the finger at an index */
    7.11  extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index);
    7.12  
    7.13  /* Get the finger with id = id */
    7.14 -extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,long id);
    7.15 +extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,SDL_FingerID id);
    7.16  
    7.17  
    7.18  /* Add a touch, possibly reattaching at a particular index (or -1),
    7.19 @@ -49,30 +49,30 @@
    7.20                       
    7.21  
    7.22  /* Remove a touch at an index, clearing the slot for later */
    7.23 -extern void SDL_DelTouch(long id);
    7.24 +extern void SDL_DelTouch(SDL_TouchID id);
    7.25  
    7.26  /* Set the touch focus window */
    7.27 -extern void SDL_SetTouchFocus(long id, SDL_Window * window);
    7.28 +extern void SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window);
    7.29  
    7.30  /* Send a touch motion event for a touch */
    7.31 -extern int SDL_SendTouchMotion(long id, long fingerid,
    7.32 +extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
    7.33  			       int relative, float x, float y, float z);
    7.34  
    7.35  /* Send a touch down/up event for a touch */
    7.36 -extern int SDL_SendFingerDown(long id, long fingerid, SDL_bool down, 
    7.37 -							  float x, float y, float pressure);
    7.38 +extern int SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, 
    7.39 +			      SDL_bool down, float x, float y, float pressure);
    7.40  
    7.41  /* Send a touch button event for a touch */
    7.42 -extern int SDL_SendTouchButton(long id, Uint8 state, Uint8 button);
    7.43 +extern int SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button);
    7.44  
    7.45  /* Shutdown the touch subsystem */
    7.46  extern void SDL_TouchQuit(void);
    7.47  
    7.48  /* Get the index of a touch device */
    7.49 -extern int SDL_GetTouchIndexId(long id);
    7.50 +extern int SDL_GetTouchIndexId(SDL_TouchID id);
    7.51  
    7.52  /* Print a debug message for a nonexistent touch */
    7.53 -extern int SDL_TouchNotFoundError(long id);
    7.54 +extern int SDL_TouchNotFoundError(SDL_TouchID id);
    7.55  
    7.56  #endif /* _SDL_touch_c_h */
    7.57  
     8.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 31 01:24:50 2010 +0400
     8.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 31 20:02:54 2010 +0400
     8.3 @@ -304,13 +304,13 @@
     8.4              touch.id = touchId;
     8.5              touch.x_min = 0;
     8.6              touch.x_max = 1;
     8.7 -            touch.xres = touch.x_max - touch.x_min;
     8.8 +            touch.native_xres = touch.x_max - touch.x_min;
     8.9              touch.y_min = 0;
    8.10              touch.y_max = 1;
    8.11 -            touch.yres = touch.y_max - touch.y_min;
    8.12 +            touch.native_yres = touch.y_max - touch.y_min;
    8.13              touch.pressure_min = 0;
    8.14              touch.pressure_max = 1;
    8.15 -            touch.pressureres = touch.pressure_max - touch.pressure_min;
    8.16 +            touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    8.17              
    8.18              if (SDL_AddTouch(&touch, "") < 0) {
    8.19                  continue;
     9.1 --- a/src/video/uikit/SDL_uikitview.m	Sat Jul 31 01:24:50 2010 +0400
     9.2 +++ b/src/video/uikit/SDL_uikitview.m	Sat Jul 31 20:02:54 2010 +0400
     9.3 @@ -58,13 +58,13 @@
     9.4  	
     9.5  	touch.x_min = 0;
     9.6  	touch.x_max = frame.size.width;
     9.7 -	touch.xres = touch.x_max - touch.x_min;
     9.8 +	touch.native_xres = touch.x_max - touch.x_min;
     9.9  	touch.y_min = 0;
    9.10  	touch.y_max = frame.size.height;
    9.11 -	touch.yres = touch.y_max - touch.y_min;
    9.12 +	touch.native_yres = touch.y_max - touch.y_min;
    9.13  	touch.pressure_min = 0;
    9.14  	touch.pressure_max = 1;
    9.15 -	touch.pressureres = touch.pressure_max - touch.pressure_min;
    9.16 +	touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    9.17  
    9.18  
    9.19  	touchId = SDL_AddTouch(&touch, "IPHONE SCREEN");
    10.1 --- a/src/video/x11/SDL_eventtouch.c	Sat Jul 31 01:24:50 2010 +0400
    10.2 +++ b/src/video/x11/SDL_eventtouch.c	Sat Jul 31 20:02:54 2010 +0400
    10.3 @@ -56,9 +56,6 @@
    10.4  	touch.pressure_max = 0;
    10.5  	touch.pressure_min = 0;
    10.6  	touch.id = event; 
    10.7 -
    10.8 -	
    10.9 -
   10.10  	
   10.11  
   10.12  	touch.driverdata = SDL_malloc(sizeof(EventTouchData));
   10.13 @@ -76,19 +73,17 @@
   10.14  	ioctl(data->eventStream,EVIOCGABS(0),abs);	
   10.15  	touch.x_min = abs[1];
   10.16  	touch.x_max = abs[2];
   10.17 -	touch.xres = touch.x_max - touch.x_min;
   10.18 +	touch.native_xres = touch.x_max - touch.x_min;
   10.19  	ioctl(data->eventStream,EVIOCGABS(ABS_Y),abs);	
   10.20  	touch.y_min = abs[1];
   10.21  	touch.y_max = abs[2];
   10.22 -	touch.yres = touch.y_max - touch.y_min;
   10.23 +	touch.native_yres = touch.y_max - touch.y_min;
   10.24  	ioctl(data->eventStream,EVIOCGABS(ABS_PRESSURE),abs);	
   10.25  	touch.pressure_min = abs[1];
   10.26  	touch.pressure_max = abs[2];
   10.27 -	touch.pressureres = touch.pressure_max - touch.pressure_min;
   10.28 -
   10.29 +	touch.native_pressureres = touch.pressure_max - touch.pressure_min;
   10.30  
   10.31  	SDL_AddTouch(&touch, tstr);
   10.32 -
   10.33        }
   10.34        vendor = -1;
   10.35        product = -1;
    11.1 --- a/touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/main.c	Sat Jul 31 01:24:50 2010 +0400
    11.2 +++ b/touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/main.c	Sat Jul 31 20:02:54 2010 +0400
    11.3 @@ -335,7 +335,7 @@
    11.4  	  case SDL_MOUSEMOTION:
    11.5  	    mousx = event.motion.x;
    11.6  	    mousy = event.motion.y; 
    11.7 -	    break;
    11.8 +	    break;		
    11.9  	  case SDL_MOUSEBUTTONDOWN:
   11.10  	    bstatus |=  (1<<(event.button.button-1));
   11.11  	    break;
   11.12 @@ -344,7 +344,7 @@
   11.13  	    break;
   11.14  	  case SDL_FINGERMOTION:    
   11.15  	    ;
   11.16 -	    printf("Finger: %li,x: %f, y: %f\n",event.tfinger.fingerId,
   11.17 +	    printf("Finger: %li,x: %i, y: %i\n",event.tfinger.fingerId,
   11.18  	    	   event.tfinger.x,event.tfinger.y);
   11.19  	    SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId);
   11.20  	    //SDL_Finger* inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId);
   11.21 @@ -353,10 +353,8 @@
   11.22  		break;
   11.23  	    if(i == MAXFINGERS) break;  
   11.24  	    if(inTouch > 0) {
   11.25 -	      finger[i].p.x = ((float)event.tfinger.x)/
   11.26 -		inTouch->xres;
   11.27 -	      finger[i].p.y = ((float)event.tfinger.y)/
   11.28 -		inTouch->yres;
   11.29 +	      finger[i].p.x = ((float)event.tfinger.x)/inTouch->xres;
   11.30 +	      finger[i].p.y = ((float)event.tfinger.y)/inTouch->yres;
   11.31  	      
   11.32  	      finger[i].pressure = 
   11.33  		((float)event.tfinger.pressure)/inTouch->pressureres;
   11.34 @@ -372,7 +370,7 @@
   11.35  	    
   11.36  	    break;	    
   11.37  	  case SDL_FINGERDOWN:
   11.38 -	    printf("Finger: %li down - x: %f, y: %f\n",event.tfinger.fingerId,
   11.39 +	    printf("Finger: %li down - x: %i, y: %i\n",event.tfinger.fingerId,
   11.40  		   event.tfinger.x,event.tfinger.y);
   11.41  
   11.42  	    for(i = 0;i<MAXFINGERS;i++) 
   11.43 @@ -384,7 +382,7 @@
   11.44  	    finger[i].p.y = event.tfinger.y;
   11.45  	    break;
   11.46  	  case SDL_FINGERUP:
   11.47 -	    printf("Figner: %li up - x: %f, y: %f\n",event.tfinger.fingerId,
   11.48 +	    printf("Figner: %li up - x: %i, y: %i\n",event.tfinger.fingerId,
   11.49  	           event.tfinger.x,event.tfinger.y);
   11.50  	    for(i = 0;i<MAXFINGERS;i++) 
   11.51  	      if(index2fingerid[i] == event.tfinger.fingerId) {