changeset 4678:f8431f66613d

Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
author jimtla
date Sat, 31 Jul 2010 20:02:54 +0400
parents 31607094315c
children 5ee96ba0c01e
files 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
diffstat 11 files changed, 108 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_events.h	Sat Jul 31 01:24:50 2010 +0400
+++ b/include/SDL_events.h	Sat Jul 31 20:02:54 2010 +0400
@@ -288,15 +288,15 @@
     Uint32 type;        /**< ::SDL_FINGERMOTION OR 
 			   SDL_FINGERDOWN OR SDL_FINGERUP*/
     Uint32 windowID;    /**< The window with mouse focus, if any */
-    long touchId;        /**< The touch device id */
-    long fingerId;
+    SDL_TouchID touchId;        /**< The touch device id */
+    SDL_FingerID fingerId;
     Uint8 state;        /**< The current button state */
     Uint8 padding1;
     Uint8 padding2;
     Uint8 padding3;
-    float x;
-    float y;
-    int pressure;
+    Uint16 x;
+    Uint16 y;
+    Uint16 pressure;
 } SDL_TouchFingerEvent;
 
 
@@ -307,7 +307,7 @@
 {
     Uint32 type;        /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
     Uint32 windowID;    /**< The window with mouse focus, if any */
-    long touchId;        /**< The touch device index */
+    SDL_TouchID touchId;        /**< The touch device index */
     Uint8 state;        /**< The current button state */
     Uint8 button;        /**< The button changing state */
     Uint8 padding1;
@@ -323,7 +323,7 @@
 {
     Uint32 type;        /**< ::SDL_MULTIGESTURE */
     Uint32 windowID;    /**< The window with mouse focus, if any */
-    long touchId;        /**< The touch device index */
+    SDL_TouchID touchId;        /**< The touch device index */
     float dTheta;
     float dDist;
     float x;  //currently 0...1. Change to screen coords?
@@ -335,8 +335,8 @@
 {
     Uint32 type;        /**< ::SDL_DOLLARGESTURE */
     Uint32 windowID;    /**< The window with mouse focus, if any */
-    long touchId;        /**< The touch device index */
-    unsigned long gestureId;
+    SDL_TouchID touchId;        /**< The touch device index */
+    SDL_GestureID gestureId;
     float error;
   /*
     //TODO: Enable to give location?
--- a/include/SDL_gesture.h	Sat Jul 31 01:24:50 2010 +0400
+++ b/include/SDL_gesture.h	Sat Jul 31 20:02:54 2010 +0400
@@ -33,6 +33,9 @@
 #include "SDL_error.h"
 #include "SDL_video.h"
 
+#include "SDL_touch.h"
+
+
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
@@ -41,6 +44,7 @@
 /* *INDENT-ON* */
 #endif
 
+  typedef Uint64 SDL_GestureID;
 
 /* Function prototypes */
 
@@ -49,7 +53,7 @@
  *
  *
  */
-  extern DECLSPEC int SDLCALL SDL_RecordGesture(int touchId);
+  extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
 
 
 /**
@@ -65,7 +69,7 @@
  *
  */
   extern DECLSPEC int 
-  SDLCALL SDL_SaveDollarTemplate(unsigned long gestureId,SDL_RWops *src);
+  SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
 
 
 /**
@@ -73,7 +77,8 @@
  *
  *
  */
-  extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(int touchId, SDL_RWops *src);
+  extern DECLSPEC 
+  int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
 
 
 
--- a/include/SDL_touch.h	Sat Jul 31 01:24:50 2010 +0400
+++ b/include/SDL_touch.h	Sat Jul 31 20:02:54 2010 +0400
@@ -42,15 +42,19 @@
 #endif
 
 
+typedef Uint64 SDL_TouchID;
+typedef Uint64 SDL_FingerID;
+
+
 struct SDL_Finger {
-  long id;
-  float x;
-  float y;
-  float xdelta;
-  float ydelta;
-  float last_x, last_y,last_pressure;  /* the last reported coordinates */
+  SDL_FingerID id;
+  Uint16 x;
+  Uint16 y;
+  Uint16 xdelta;
+  Uint16 ydelta;
+  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
   SDL_bool down;
-  float pressure;
+  Uint16 pressure;
 };
 
 typedef struct SDL_Touch SDL_Touch;
@@ -66,12 +70,13 @@
   float pressure_max, pressure_min;
   float x_max,x_min;
   float y_max,y_min;
-  float xres,yres,pressureres;
+  Uint16 xres,yres,pressureres;
+  float native_xres,native_yres,native_pressureres;
   float tilt;                   /* for future use */
   float rotation;               /* for future use */
   
   /* Data common to all touch */
-  long id;
+  SDL_TouchID id;
   SDL_Window *focus;
   
   char *name;
@@ -95,7 +100,7 @@
  *
  *
  */
-  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(long id);
+  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
 
 
 
@@ -104,7 +109,8 @@
  *
  *
  */
-  extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, long id);
+  extern 
+  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
--- a/src/events/SDL_gesture.c	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/events/SDL_gesture.c	Sat Jul 31 20:02:54 2010 +0400
@@ -46,7 +46,7 @@
 typedef struct {
   Point p;
   float pressure;
-  int id;
+  SDL_FingerID id;
 } Finger;
 
 
@@ -71,7 +71,7 @@
 } DollarTemplate;
 
 typedef struct {
-  int id;
+  SDL_GestureID id;
   Point res;
   Point centroid;
   TouchPoint gestureLast[MAXFINGERS];
@@ -87,7 +87,7 @@
 int numGestureTouches = 0;
 SDL_bool recordAll;
 
-int SDL_RecordGesture(int touchId) {
+int SDL_RecordGesture(SDL_TouchID touchId) {
   int i;
   if(touchId < 0) recordAll = SDL_TRUE;
   for(i = 0;i < numGestureTouches; i++) {
@@ -143,7 +143,7 @@
   return rtrn;  
 }
 
-int SDL_SaveDollarTemplate(unsigned long gestureId, SDL_RWops *src) {
+int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) {
   int i,j;
   for(i = 0; i < numGestureTouches; i++) {
     GestureTouch* touch = &gestureTouch[i];
@@ -185,7 +185,7 @@
   return -1;
 }
 
-int SDL_LoadDollarTemplates(int touchId, SDL_RWops *src) {
+int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
   if(src == NULL) return 0;
   int i,loaded = 0;
   GestureTouch *touch = NULL;
@@ -394,7 +394,7 @@
   return 0;
 }
 
-GestureTouch * SDL_GetGestureTouch(int id) {
+GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
   int i;
   for(i = 0;i < numGestureTouches; i++) {
     //printf("%i ?= %i\n",gestureTouch[i].id,id);
@@ -414,7 +414,8 @@
   return SDL_PushEvent(&event) > 0;
 }
 
-int SDL_SendGestureDollar(GestureTouch* touch,int gestureId,float error) {
+int SDL_SendGestureDollar(GestureTouch* touch,
+			  SDL_GestureID gestureId,float error) {
   SDL_Event event;
   event.dgesture.type = SDL_DOLLARGESTURE;
   event.dgesture.touchId = touch->id;
@@ -429,7 +430,7 @@
 }
 
 
-int SDL_SendDollarRecord(GestureTouch* touch,int gestureId) {
+int SDL_SendDollarRecord(GestureTouch* touch,SDL_GestureID gestureId) {
   SDL_Event event;
   event.dgesture.type = SDL_DOLLARRECORD;
   event.dgesture.touchId = touch->id;
@@ -489,7 +490,7 @@
 				  &bestTempl,inTouch);
 	  if(bestTempl >= 0){
 	    //Send Event
-	    int gestureId = inTouch->dollarTemplate[bestTempl].hash;
+	    unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
 	    SDL_SendGestureDollar(inTouch,gestureId,error);
 	    printf("Dollar error: %f\n",error);
 	  }
--- a/src/events/SDL_gesture_c.h	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/events/SDL_gesture_c.h	Sat Jul 31 20:02:54 2010 +0400
@@ -26,7 +26,7 @@
 
 extern void SDL_GestureProcessEvent(SDL_Event* event);
 
-extern int SDL_RecordGesture(int touchId);
+extern int SDL_RecordGesture(SDL_TouchID touchId);
 
 extern int SDL_GestureAddTouch(SDL_Touch* touch);
 
--- a/src/events/SDL_touch.c	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/events/SDL_touch.c	Sat Jul 31 20:02:54 2010 +0400
@@ -42,7 +42,7 @@
 }
 
 SDL_Touch *
-SDL_GetTouch(long id)
+SDL_GetTouch(SDL_TouchID id)
 {
     int index = SDL_GetTouchIndexId(id);
     if (index < 0 || index >= SDL_num_touch) {
@@ -61,7 +61,7 @@
 }
 
 int
-SDL_GetFingerIndexId(SDL_Touch* touch,long fingerid)
+SDL_GetFingerIndexId(SDL_Touch* touch,SDL_FingerID fingerid)
 {
     int i;
     for(i = 0;i < touch->num_fingers;i++)
@@ -72,7 +72,7 @@
 
 
 SDL_Finger *
-SDL_GetFinger(SDL_Touch* touch,long id)
+SDL_GetFinger(SDL_Touch* touch,SDL_FingerID id)
 {
     int index = SDL_GetFingerIndexId(touch,id);
     if(index < 0 || index >= touch->num_fingers)
@@ -82,7 +82,7 @@
 
 
 int
-SDL_GetTouchIndexId(long id)
+SDL_GetTouchIndexId(SDL_TouchID id)
 {
     int index;
     SDL_Touch *touch;
@@ -139,6 +139,8 @@
     SDL_touchPads[index]->relative_mode = SDL_FALSE;
     SDL_touchPads[index]->flush_motion = SDL_FALSE;
     
+    SDL_touchPads[index]->xres = (1<<(16-1));
+    SDL_touchPads[index]->yres = (1<<(16-1));
     //Do I want this here? Probably
     SDL_GestureAddTouch(SDL_touchPads[index]);
 
@@ -146,7 +148,7 @@
 }
 
 void
-SDL_DelTouch(long id)
+SDL_DelTouch(SDL_TouchID id)
 {
     int index = SDL_GetTouchIndexId(id);
     SDL_Touch *touch = SDL_GetTouch(id);
@@ -189,7 +191,7 @@
     return SDL_num_touch;
 }
 SDL_Window *
-SDL_GetTouchFocusWindow(long id)
+SDL_GetTouchFocusWindow(SDL_TouchID id)
 {
     SDL_Touch *touch = SDL_GetTouch(id);
 
@@ -200,7 +202,7 @@
 }
 
 void
-SDL_SetTouchFocus(long id, SDL_Window * window)
+SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window)
 {
     int index = SDL_GetTouchIndexId(id);
     SDL_Touch *touch = SDL_GetTouch(id);
@@ -250,12 +252,12 @@
 }
 
 int 
-SDL_AddFinger(SDL_Touch* touch,SDL_Finger finger)
+SDL_AddFinger(SDL_Touch* touch,SDL_Finger *finger)
 {
     int index;
     SDL_Finger **fingers;
     //printf("Adding Finger...\n");
-    if (SDL_GetFingerIndexId(touch,finger.id) != -1) {
+    if (SDL_GetFingerIndexId(touch,finger->id) != -1) {
         SDL_SetError("Finger ID already in use");
 	}
 
@@ -282,14 +284,14 @@
         SDL_OutOfMemory();
         return -1;
     }
-    *(touch->fingers[index]) = finger;
+    *(touch->fingers[index]) = *finger;
     touch->num_fingers++;
 
     return index;
 }
 
 int
-SDL_DelFinger(SDL_Touch* touch,long fingerid)
+SDL_DelFinger(SDL_Touch* touch,SDL_FingerID fingerid)
 {
     int index = SDL_GetFingerIndexId(touch,fingerid);
     SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
@@ -307,7 +309,8 @@
 
 
 int
-SDL_SendFingerDown(long id, long fingerid, SDL_bool down, float x, float y, float pressure)
+SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, 
+		   float xin, float yin, float pressurein)
 {
     int posted;
     SDL_Touch* touch = SDL_GetTouch(id);
@@ -315,11 +318,15 @@
     if(!touch) {
       return SDL_TouchNotFoundError(id);
     }
-
+    //scale to Integer coordinates
+    Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
+    Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
+	Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
     if(down) {
 	SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
+	SDL_Finger nf;
 	if(finger == NULL) {
-	    SDL_Finger nf;
+	    
 	    nf.id = fingerid;
 	    nf.x = x;
 	    nf.y = y;
@@ -330,11 +337,11 @@
 	    nf.last_y = y;
 	    nf.last_pressure = pressure;
 	    nf.down = SDL_FALSE;
-	    SDL_AddFinger(touch,nf);
+	    SDL_AddFinger(touch,&nf);
 	    finger = &nf;
 	}
 	else if(finger->down) return 0;
-	if(x < 0 || y < 0) return 0; //should defer if only a partial input
+	if(xin < touch->x_min || yin < touch->y_min) return 0; //should defer if only a partial input
 	posted = 0;
 	if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
 	    SDL_Event event;
@@ -367,8 +374,8 @@
 }
 
 int
-SDL_SendTouchMotion(long id, long fingerid, int relative, 
-		    float x, float y, float pressure)
+SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative, 
+		    float xin, float yin, float pressurein)
 {
     int index = SDL_GetTouchIndexId(id);
     SDL_Touch *touch = SDL_GetTouch(id);
@@ -381,6 +388,12 @@
     if (!touch) {
       return SDL_TouchNotFoundError(id);
     }
+
+    //scale to Integer coordinates
+    Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
+    Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
+	Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
+	printf("(%f,%f) --> (%i,%i)",xin,yin,x,y);
     if(touch->flush_motion) {
 	return 0;
     }
@@ -395,9 +408,9 @@
 	    x = (finger->last_x + x);
 	    y = (finger->last_y + y);
 	} else {
-	    if(x < 0) x = finger->last_x; /*If movement is only in one axis,*/
-	    if(y < 0) y = finger->last_y; /*The other is marked as -1*/
-	    if(pressure < 0) pressure = finger->last_pressure;
+	    if(xin < touch->x_min) x = finger->last_x; /*If movement is only in one axis,*/
+	    if(yin < touch->y_min) y = finger->last_y; /*The other is marked as -1*/
+	    if(pressurein < touch->pressure_min) pressure = finger->last_pressure;
 	    xrel = x - finger->last_x;
 	    yrel = y - finger->last_y;
 	}
@@ -448,6 +461,7 @@
 	    event.tfinger.fingerId = fingerid;
 	    event.tfinger.x = x;
 	    event.tfinger.y = y;
+		
 	    event.tfinger.pressure = pressure;
 	    event.tfinger.state = touch->buttonstate;
 	    event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
@@ -460,7 +474,7 @@
     }
 }
 int
-SDL_SendTouchButton(long id, Uint8 state, Uint8 button)
+SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button)
 {
     SDL_Touch *touch = SDL_GetTouch(id);
     int posted;
@@ -509,7 +523,7 @@
 }
 
 char *
-SDL_GetTouchName(long id)
+SDL_GetTouchName(SDL_TouchID id)
 {
     SDL_Touch *touch = SDL_GetTouch(id);
     if (!touch) {
@@ -518,7 +532,7 @@
     return touch->name;
 }
 
-int SDL_TouchNotFoundError(long id) {
+int SDL_TouchNotFoundError(SDL_TouchID id) {
   printf("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id);
   printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
   int i;
--- a/src/events/SDL_touch_c.h	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/events/SDL_touch_c.h	Sat Jul 31 20:02:54 2010 +0400
@@ -34,13 +34,13 @@
 extern SDL_Touch *SDL_GetTouchIndex(int index);
 
 /* Get the touch with id = id */
-extern SDL_Touch *SDL_GetTouch(long id);
+extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
 
 /*Get the finger at an index */
 extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index);
 
 /* Get the finger with id = id */
-extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,long id);
+extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,SDL_FingerID id);
 
 
 /* Add a touch, possibly reattaching at a particular index (or -1),
@@ -49,30 +49,30 @@
                      
 
 /* Remove a touch at an index, clearing the slot for later */
-extern void SDL_DelTouch(long id);
+extern void SDL_DelTouch(SDL_TouchID id);
 
 /* Set the touch focus window */
-extern void SDL_SetTouchFocus(long id, SDL_Window * window);
+extern void SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window);
 
 /* Send a touch motion event for a touch */
-extern int SDL_SendTouchMotion(long id, long fingerid,
+extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
 			       int relative, float x, float y, float z);
 
 /* Send a touch down/up event for a touch */
-extern int SDL_SendFingerDown(long id, long fingerid, SDL_bool down, 
-							  float x, float y, float pressure);
+extern int SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, 
+			      SDL_bool down, float x, float y, float pressure);
 
 /* Send a touch button event for a touch */
-extern int SDL_SendTouchButton(long id, Uint8 state, Uint8 button);
+extern int SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button);
 
 /* Shutdown the touch subsystem */
 extern void SDL_TouchQuit(void);
 
 /* Get the index of a touch device */
-extern int SDL_GetTouchIndexId(long id);
+extern int SDL_GetTouchIndexId(SDL_TouchID id);
 
 /* Print a debug message for a nonexistent touch */
-extern int SDL_TouchNotFoundError(long id);
+extern int SDL_TouchNotFoundError(SDL_TouchID id);
 
 #endif /* _SDL_touch_c_h */
 
--- a/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 31 20:02:54 2010 +0400
@@ -304,13 +304,13 @@
             touch.id = touchId;
             touch.x_min = 0;
             touch.x_max = 1;
-            touch.xres = touch.x_max - touch.x_min;
+            touch.native_xres = touch.x_max - touch.x_min;
             touch.y_min = 0;
             touch.y_max = 1;
-            touch.yres = touch.y_max - touch.y_min;
+            touch.native_yres = touch.y_max - touch.y_min;
             touch.pressure_min = 0;
             touch.pressure_max = 1;
-            touch.pressureres = touch.pressure_max - touch.pressure_min;
+            touch.native_pressureres = touch.pressure_max - touch.pressure_min;
             
             if (SDL_AddTouch(&touch, "") < 0) {
                 continue;
--- a/src/video/uikit/SDL_uikitview.m	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/video/uikit/SDL_uikitview.m	Sat Jul 31 20:02:54 2010 +0400
@@ -58,13 +58,13 @@
 	
 	touch.x_min = 0;
 	touch.x_max = frame.size.width;
-	touch.xres = touch.x_max - touch.x_min;
+	touch.native_xres = touch.x_max - touch.x_min;
 	touch.y_min = 0;
 	touch.y_max = frame.size.height;
-	touch.yres = touch.y_max - touch.y_min;
+	touch.native_yres = touch.y_max - touch.y_min;
 	touch.pressure_min = 0;
 	touch.pressure_max = 1;
-	touch.pressureres = touch.pressure_max - touch.pressure_min;
+	touch.native_pressureres = touch.pressure_max - touch.pressure_min;
 
 
 	touchId = SDL_AddTouch(&touch, "IPHONE SCREEN");
--- a/src/video/x11/SDL_eventtouch.c	Sat Jul 31 01:24:50 2010 +0400
+++ b/src/video/x11/SDL_eventtouch.c	Sat Jul 31 20:02:54 2010 +0400
@@ -56,9 +56,6 @@
 	touch.pressure_max = 0;
 	touch.pressure_min = 0;
 	touch.id = event; 
-
-	
-
 	
 
 	touch.driverdata = SDL_malloc(sizeof(EventTouchData));
@@ -76,19 +73,17 @@
 	ioctl(data->eventStream,EVIOCGABS(0),abs);	
 	touch.x_min = abs[1];
 	touch.x_max = abs[2];
-	touch.xres = touch.x_max - touch.x_min;
+	touch.native_xres = touch.x_max - touch.x_min;
 	ioctl(data->eventStream,EVIOCGABS(ABS_Y),abs);	
 	touch.y_min = abs[1];
 	touch.y_max = abs[2];
-	touch.yres = touch.y_max - touch.y_min;
+	touch.native_yres = touch.y_max - touch.y_min;
 	ioctl(data->eventStream,EVIOCGABS(ABS_PRESSURE),abs);	
 	touch.pressure_min = abs[1];
 	touch.pressure_max = abs[2];
-	touch.pressureres = touch.pressure_max - touch.pressure_min;
-
+	touch.native_pressureres = touch.pressure_max - touch.pressure_min;
 
 	SDL_AddTouch(&touch, tstr);
-
       }
       vendor = -1;
       product = -1;
--- a/touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/main.c	Sat Jul 31 01:24:50 2010 +0400
+++ b/touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/main.c	Sat Jul 31 20:02:54 2010 +0400
@@ -335,7 +335,7 @@
 	  case SDL_MOUSEMOTION:
 	    mousx = event.motion.x;
 	    mousy = event.motion.y; 
-	    break;
+	    break;		
 	  case SDL_MOUSEBUTTONDOWN:
 	    bstatus |=  (1<<(event.button.button-1));
 	    break;
@@ -344,7 +344,7 @@
 	    break;
 	  case SDL_FINGERMOTION:    
 	    ;
-	    printf("Finger: %li,x: %f, y: %f\n",event.tfinger.fingerId,
+	    printf("Finger: %li,x: %i, y: %i\n",event.tfinger.fingerId,
 	    	   event.tfinger.x,event.tfinger.y);
 	    SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId);
 	    //SDL_Finger* inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId);
@@ -353,10 +353,8 @@
 		break;
 	    if(i == MAXFINGERS) break;  
 	    if(inTouch > 0) {
-	      finger[i].p.x = ((float)event.tfinger.x)/
-		inTouch->xres;
-	      finger[i].p.y = ((float)event.tfinger.y)/
-		inTouch->yres;
+	      finger[i].p.x = ((float)event.tfinger.x)/inTouch->xres;
+	      finger[i].p.y = ((float)event.tfinger.y)/inTouch->yres;
 	      
 	      finger[i].pressure = 
 		((float)event.tfinger.pressure)/inTouch->pressureres;
@@ -372,7 +370,7 @@
 	    
 	    break;	    
 	  case SDL_FINGERDOWN:
-	    printf("Finger: %li down - x: %f, y: %f\n",event.tfinger.fingerId,
+	    printf("Finger: %li down - x: %i, y: %i\n",event.tfinger.fingerId,
 		   event.tfinger.x,event.tfinger.y);
 
 	    for(i = 0;i<MAXFINGERS;i++) 
@@ -384,7 +382,7 @@
 	    finger[i].p.y = event.tfinger.y;
 	    break;
 	  case SDL_FINGERUP:
-	    printf("Figner: %li up - x: %f, y: %f\n",event.tfinger.fingerId,
+	    printf("Figner: %li up - x: %i, y: %i\n",event.tfinger.fingerId,
 	           event.tfinger.x,event.tfinger.y);
 	    for(i = 0;i<MAXFINGERS;i++) 
 	      if(index2fingerid[i] == event.tfinger.fingerId) {