Fixed gestureMulti. Disabled dollar gesture temporarily.
authorJim Grandpre <jim.tla@gmail.com>
Wed, 04 Aug 2010 23:17:30 -0400
changeset 468315dfe42edbfd
parent 4682 4ba1048a324c
child 4684 f47c2640c667
Fixed gestureMulti. Disabled dollar gesture temporarily.
include/SDL_events.h
src/events/SDL_gesture.c
src/events/SDL_touch.c
src/video/x11/SDL_eventtouch.c
src/video/x11/SDL_x11events.c
touchTest/gestureSDLTest.c
     1.1 --- a/include/SDL_events.h	Tue Aug 03 00:18:00 2010 -0400
     1.2 +++ b/include/SDL_events.h	Wed Aug 04 23:17:30 2010 -0400
     1.3 @@ -296,6 +296,8 @@
     1.4      Uint8 padding3;
     1.5      Uint16 x;
     1.6      Uint16 y;
     1.7 +    Sint16 dx;
     1.8 +    Sint16 dy;
     1.9      Uint16 pressure;
    1.10  } SDL_TouchFingerEvent;
    1.11  
    1.12 @@ -328,7 +330,8 @@
    1.13      float dDist;
    1.14      float x;  //currently 0...1. Change to screen coords?
    1.15      float y;  
    1.16 -
    1.17 +    Uint16 numFingers;
    1.18 +    Uint16 padding;
    1.19  } SDL_MultiGestureEvent;
    1.20  
    1.21  typedef struct SDL_DollarGestureEvent
     2.1 --- a/src/events/SDL_gesture.c	Tue Aug 03 00:18:00 2010 -0400
     2.2 +++ b/src/events/SDL_gesture.c	Wed Aug 04 23:17:30 2010 -0400
     2.3 @@ -75,7 +75,7 @@
     2.4    Point res;
     2.5    Point centroid;
     2.6    TouchPoint gestureLast[MAXFINGERS];
     2.7 -  int numDownFingers;
     2.8 +  Uint16 numDownFingers;
     2.9  
    2.10    int numDollarTemplates;
    2.11    DollarTemplate dollarTemplate[MAXTEMPLATES];
    2.12 @@ -406,6 +406,7 @@
    2.13    event.mgesture.y = touch->centroid.y;
    2.14    event.mgesture.dTheta = dTheta;
    2.15    event.mgesture.dDist = dDist;  
    2.16 +  event.mgesture.numFingers = touch->numDownFingers;
    2.17    return SDL_PushEvent(&event) > 0;
    2.18  }
    2.19  
    2.20 @@ -441,140 +442,161 @@
    2.21       event->type == SDL_FINGERDOWN ||
    2.22       event->type == SDL_FINGERUP) {
    2.23      GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
    2.24 -
    2.25 +    
    2.26      //Shouldn't be possible
    2.27      if(inTouch == NULL) return;
    2.28      
    2.29 +    //printf("@ (%i,%i) with res: (%i,%i)\n",(int)event->tfinger.x,
    2.30 +    //	   (int)event->tfinger.y,
    2.31 +    //   (int)inTouch->res.x,(int)inTouch->res.y);
    2.32 +
    2.33      
    2.34 -    float x = ((float)event->tfinger.x)/inTouch->res.x;
    2.35 -    float y = ((float)event->tfinger.y)/inTouch->res.y;
    2.36 -    int j,empty = -1;
    2.37 -    
    2.38 -    for(j = 0;j<inTouch->numDownFingers;j++) {
    2.39 -      if(inTouch->gestureLast[j].f.id != event->tfinger.fingerId) continue;
    2.40 -      //Finger Up
    2.41 -      if(event->type == SDL_FINGERUP) {
    2.42 -	inTouch->numDownFingers--;
    2.43 +    float x = ((float)event->tfinger.x)/(float)inTouch->res.x;
    2.44 +    float y = ((float)event->tfinger.y)/(float)inTouch->res.y;   
    2.45  
    2.46 -	if(inTouch->recording) {
    2.47 -	  inTouch->recording = SDL_FALSE;
    2.48 -	  Point path[DOLLARNPOINTS];
    2.49 -	  dollarNormalize(inTouch->gestureLast[j].dollarPath,path);
    2.50 -	  int index;
    2.51 -	  if(recordAll) {
    2.52 -	    index = SDL_AddDollarGesture(NULL,path);
    2.53 -	    int i;
    2.54 -	    for(i = 0;i < numGestureTouches; i++)
    2.55 -	      gestureTouch[i].recording = SDL_FALSE;
    2.56 -	  }
    2.57 -	  else {
    2.58 -	    index = SDL_AddDollarGesture(inTouch,path);
    2.59 -	  }
    2.60 -	  
    2.61 -	  if(index >= 0) {
    2.62 -	    SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash);
    2.63 -	  }
    2.64 -	  else {
    2.65 -	    SDL_SendDollarRecord(inTouch,-1);
    2.66 -	  }
    2.67 -	}
    2.68 -	else {	
    2.69 -	  int bestTempl;
    2.70 -	  float error;
    2.71 -	  error = dollarRecognize(inTouch->gestureLast[j].dollarPath,
    2.72 -				  &bestTempl,inTouch);
    2.73 -	  if(bestTempl >= 0){
    2.74 -	    //Send Event
    2.75 -	    unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
    2.76 -	    SDL_SendGestureDollar(inTouch,gestureId,error);
    2.77 -	    printf("Dollar error: %f\n",error);
    2.78 -	  }
    2.79 -	} 
    2.80 -	inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers];
    2.81 -	j = -1;
    2.82 -	break;
    2.83 -      }
    2.84 -      else if(event->type == SDL_FINGERMOTION) {
    2.85 -	float dx = x - inTouch->gestureLast[j].f.p.x;
    2.86 -	float dy = y - inTouch->gestureLast[j].f.p.y;
    2.87 -	DollarPath* path = &inTouch->gestureLast[j].dollarPath;
    2.88 -	if(path->numPoints < MAXPATHSIZE) {
    2.89 -	  path->p[path->numPoints].x = x;
    2.90 -	  path->p[path->numPoints].y = y;
    2.91 -	  path->length += sqrt(dx*dx + dy*dy);
    2.92 -	  path->numPoints++;
    2.93 -	}
    2.94  
    2.95 -
    2.96 -	inTouch->centroid.x += dx/inTouch->numDownFingers;
    2.97 -	inTouch->centroid.y += dy/inTouch->numDownFingers;    
    2.98 -	if(inTouch->numDownFingers > 1) {
    2.99 -	  Point lv; //Vector from centroid to last x,y position
   2.100 -	  Point v; //Vector from centroid to current x,y position
   2.101 -	  lv = inTouch->gestureLast[j].cv;
   2.102 -	  float lDist = sqrt(lv.x*lv.x + lv.y*lv.y);
   2.103 -	  //printf("lDist = %f\n",lDist);
   2.104 -	  v.x = x - inTouch->centroid.x;
   2.105 -	  v.y = y - inTouch->centroid.y;
   2.106 -	  inTouch->gestureLast[j].cv = v;
   2.107 -	  float Dist = sqrt(v.x*v.x+v.y*v.y);
   2.108 -	  // cos(dTheta) = (v . lv)/(|v| * |lv|)
   2.109 -	  
   2.110 -	  //Normalize Vectors to simplify angle calculation
   2.111 -	  lv.x/=lDist;
   2.112 -	  lv.y/=lDist;
   2.113 -	  v.x/=Dist;
   2.114 -	  v.y/=Dist;
   2.115 -	  float dtheta = atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
   2.116 -	  
   2.117 -	  float dDist = (Dist - lDist);
   2.118 -	  if(lDist == 0) {dDist = 0;dtheta = 0;} //To avoid impossible values
   2.119 -	  inTouch->gestureLast[j].dDist = dDist;
   2.120 -	  inTouch->gestureLast[j].dtheta = dtheta;
   2.121 -	  
   2.122 -	  //printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
   2.123 -	  //gdtheta = gdtheta*.9 + dtheta*.1;
   2.124 -	  //gdDist  =  gdDist*.9 +  dDist*.1
   2.125 -	  //knob.r += dDist/numDownFingers;
   2.126 -	  //knob.ang += dtheta;
   2.127 -	  //printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
   2.128 -	  //printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist);
   2.129 -	  SDL_SendGestureMulti(inTouch,dtheta,dDist);
   2.130 +    //Finger Up
   2.131 +    if(event->type == SDL_FINGERUP) {
   2.132 +      inTouch->numDownFingers--;
   2.133 +      
   2.134 +#ifdef ENABLE_DOLLAR
   2.135 +      if(inTouch->recording) {
   2.136 +	inTouch->recording = SDL_FALSE;
   2.137 +	Point path[DOLLARNPOINTS];
   2.138 +	dollarNormalize(inTouch->gestureLast[j].dollarPath,path);
   2.139 +	int index;
   2.140 +	if(recordAll) {
   2.141 +	  index = SDL_AddDollarGesture(NULL,path);
   2.142 +	  int i;
   2.143 +	  for(i = 0;i < numGestureTouches; i++)
   2.144 +	    gestureTouch[i].recording = SDL_FALSE;
   2.145  	}
   2.146  	else {
   2.147 -	  inTouch->gestureLast[j].dDist = 0;
   2.148 -	  inTouch->gestureLast[j].dtheta = 0;
   2.149 -	  inTouch->gestureLast[j].cv.x = 0;
   2.150 -	  inTouch->gestureLast[j].cv.y = 0;
   2.151 +	  index = SDL_AddDollarGesture(inTouch,path);
   2.152  	}
   2.153 -	inTouch->gestureLast[j].f.p.x = x;
   2.154 -	inTouch->gestureLast[j].f.p.y = y;
   2.155 -	break;
   2.156 -	//pressure?
   2.157 -      }      
   2.158 +	
   2.159 +	if(index >= 0) {
   2.160 +	  SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash);
   2.161 +	}
   2.162 +	else {
   2.163 +	  SDL_SendDollarRecord(inTouch,-1);
   2.164 +	}
   2.165 +      }
   2.166 +      else {	
   2.167 +	int bestTempl;
   2.168 +	float error;
   2.169 +	error = dollarRecognize(inTouch->gestureLast[j].dollarPath,
   2.170 +				&bestTempl,inTouch);
   2.171 +	if(bestTempl >= 0){
   2.172 +	  //Send Event
   2.173 +	  unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
   2.174 +	  SDL_SendGestureDollar(inTouch,gestureId,error);
   2.175 +	    printf ("%s\n",);("Dollar error: %f\n",error);
   2.176 +	}
   2.177 +      }
   2.178 +#endif 
   2.179 +      //inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers];
   2.180 +      if(inTouch->numDownFingers > 0) {
   2.181 +	inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers+1)-
   2.182 +			       x)/inTouch->numDownFingers;
   2.183 +	inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers+1)-
   2.184 +			       y)/inTouch->numDownFingers;
   2.185 +      }
   2.186 +    }
   2.187 +    else if(event->type == SDL_FINGERMOTION) {
   2.188 +      float dx = ((float)event->tfinger.dx)/(float)inTouch->res.x;
   2.189 +      float dy = ((float)event->tfinger.dy)/(float)inTouch->res.y;
   2.190 +      //printf("dx,dy: (%f,%f)\n",dx,dy); 
   2.191 +#ifdef ENABLE_DOLLAR
   2.192 +      DollarPath* path = &inTouch->gestureLast[j].dollarPath;
   2.193 +      if(path->numPoints < MAXPATHSIZE) {
   2.194 +	path->p[path->numPoints].x = x;
   2.195 +	path->p[path->numPoints].y = y;
   2.196 +	path->length += sqrt(dx*dx + dy*dy);
   2.197 +	path->numPoints++;
   2.198 +      }
   2.199 +#endif
   2.200 +      Point lastP;
   2.201 +      lastP.x = x - dx;
   2.202 +      lastP.y = y - dy;
   2.203 +      Point lastCentroid;
   2.204 +      lastCentroid = inTouch->centroid;
   2.205 +      
   2.206 +      inTouch->centroid.x += dx/inTouch->numDownFingers;
   2.207 +      inTouch->centroid.y += dy/inTouch->numDownFingers;    
   2.208 +      if(inTouch->numDownFingers > 1) {
   2.209 +	Point lv; //Vector from centroid to last x,y position
   2.210 +	Point v; //Vector from centroid to current x,y position
   2.211 +	//lv = inTouch->gestureLast[j].cv;
   2.212 +	lv.x = lastP.x - lastCentroid.x;
   2.213 +	lv.y = lastP.y - lastCentroid.y;
   2.214 +	float lDist = sqrt(lv.x*lv.x + lv.y*lv.y);
   2.215 +	//printf("lDist = %f\n",lDist);
   2.216 +	v.x = x - inTouch->centroid.x;
   2.217 +	v.y = y - inTouch->centroid.y;
   2.218 +	//inTouch->gestureLast[j].cv = v;
   2.219 +	float Dist = sqrt(v.x*v.x+v.y*v.y);
   2.220 +	// cos(dTheta) = (v . lv)/(|v| * |lv|)
   2.221 +	
   2.222 +	//Normalize Vectors to simplify angle calculation
   2.223 +	lv.x/=lDist;
   2.224 +	lv.y/=lDist;
   2.225 +	v.x/=Dist;
   2.226 +	v.y/=Dist;
   2.227 +	float dtheta = atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
   2.228 +	
   2.229 +	float dDist = (Dist - lDist);
   2.230 +	if(lDist == 0) {dDist = 0;dtheta = 0;} //To avoid impossible values
   2.231 +	
   2.232 +	//inTouch->gestureLast[j].dDist = dDist;
   2.233 +	//inTouch->gestureLast[j].dtheta = dtheta;
   2.234 +	
   2.235 +	//printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
   2.236 +	//gdtheta = gdtheta*.9 + dtheta*.1;
   2.237 +	//gdDist  =  gdDist*.9 +  dDist*.1
   2.238 +	//knob.r += dDist/numDownFingers;
   2.239 +	//knob.ang += dtheta;
   2.240 +	//printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
   2.241 +	//printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist);
   2.242 +	SDL_SendGestureMulti(inTouch,dtheta,dDist);
   2.243 +      }
   2.244 +      else {
   2.245 +	//inTouch->gestureLast[j].dDist = 0;
   2.246 +	//inTouch->gestureLast[j].dtheta = 0;
   2.247 +	//inTouch->gestureLast[j].cv.x = 0;
   2.248 +	//inTouch->gestureLast[j].cv.y = 0;
   2.249 +      }
   2.250 +      //inTouch->gestureLast[j].f.p.x = x;
   2.251 +      //inTouch->gestureLast[j].f.p.y = y;
   2.252 +      //break;
   2.253 +      //pressure?
   2.254      }
   2.255      
   2.256 -    if(j == inTouch->numDownFingers) {
   2.257 -      //printf("Finger Down!!!\n");
   2.258 +    if(event->type == SDL_FINGERDOWN) {
   2.259 +
   2.260        inTouch->numDownFingers++;
   2.261        inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers - 1)+ 
   2.262  			     x)/inTouch->numDownFingers;
   2.263        inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers - 1)+
   2.264  			     y)/inTouch->numDownFingers;
   2.265 -      
   2.266 -      inTouch->gestureLast[j].f.id = event->tfinger.fingerId;
   2.267 -      inTouch->gestureLast[j].f.p.x  = x;
   2.268 -      inTouch->gestureLast[j].f.p.y  = y;	
   2.269 -      inTouch->gestureLast[j].cv.x = 0;
   2.270 -      inTouch->gestureLast[j].cv.y = 0;
   2.271 -
   2.272 +      printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
   2.273 +	     inTouch->centroid.x,inTouch->centroid.y);
   2.274 +      /*
   2.275 +	inTouch->gestureLast[j].f.id = event->tfinger.fingerId;
   2.276 +	inTouch->gestureLast[j].f.p.x  = x;
   2.277 +	inTouch->gestureLast[j].f.p.y  = y;	
   2.278 +	inTouch->gestureLast[j].cv.x = 0;
   2.279 +	inTouch->gestureLast[j].cv.y = 0;
   2.280 +      */
   2.281 +#ifdef ENABlE_DOLLAR
   2.282        inTouch->gestureLast[j].dollarPath.length = 0;
   2.283        inTouch->gestureLast[j].dollarPath.p[0].x = x;
   2.284        inTouch->gestureLast[j].dollarPath.p[0].y = y;
   2.285        inTouch->gestureLast[j].dollarPath.numPoints = 1;
   2.286 +#endif
   2.287      }
   2.288    }
   2.289 -}  
   2.290 -  
   2.291 +}
   2.292 +
   2.293    /* vi: set ts=4 sw=4 expandtab: */
   2.294    
     3.1 --- a/src/events/SDL_touch.c	Tue Aug 03 00:18:00 2010 -0400
     3.2 +++ b/src/events/SDL_touch.c	Wed Aug 04 23:17:30 2010 -0400
     3.3 @@ -318,15 +318,17 @@
     3.4      if(!touch) {
     3.5        return SDL_TouchNotFoundError(id);
     3.6      }
     3.7 +
     3.8 +    
     3.9      //scale to Integer coordinates
    3.10      Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
    3.11      Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
    3.12 -	Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
    3.13 +    Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
    3.14 +    
    3.15 +    SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
    3.16      if(down) {
    3.17 -	SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
    3.18 -	SDL_Finger nf;
    3.19  	if(finger == NULL) {
    3.20 -	    
    3.21 +	    SDL_Finger nf;
    3.22  	    nf.id = fingerid;
    3.23  	    nf.x = x;
    3.24  	    nf.y = y;
    3.25 @@ -337,8 +339,8 @@
    3.26  	    nf.last_y = y;
    3.27  	    nf.last_pressure = pressure;
    3.28  	    nf.down = SDL_FALSE;
    3.29 -	    SDL_AddFinger(touch,&nf);
    3.30 -	    finger = &nf;
    3.31 +	    if(SDL_AddFinger(touch,&nf) < 0) return 0;
    3.32 +	    finger = SDL_GetFinger(touch,fingerid);
    3.33  	}
    3.34  	else if(finger->down) return 0;
    3.35  	if(xin < touch->x_min || yin < touch->y_min) return 0; //should defer if only a partial input
    3.36 @@ -358,7 +360,7 @@
    3.37  	return posted;
    3.38      }
    3.39      else {
    3.40 -	if(SDL_DelFinger(touch,fingerid) < 0) return 0;
    3.41 +        if(finger == NULL) {printf("Finger not found...\n");return 0;}      
    3.42  	posted = 0;
    3.43  	if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
    3.44  	    SDL_Event event;
    3.45 @@ -367,8 +369,15 @@
    3.46  	    event.tfinger.state = touch->buttonstate;
    3.47  	    event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
    3.48  	    event.tfinger.fingerId = fingerid;
    3.49 +	    //I don't trust the coordinates passed on fingerUp
    3.50 +	    event.tfinger.x = finger->x; 
    3.51 +	    event.tfinger.y = finger->y;
    3.52 +	    event.tfinger.dx = 0;
    3.53 +	    event.tfinger.dy = 0;
    3.54 +
    3.55 +	    if(SDL_DelFinger(touch,fingerid) < 0) return 0;
    3.56  	    posted = (SDL_PushEvent(&event) > 0);
    3.57 -	}
    3.58 +	}	
    3.59  	return posted;
    3.60      }
    3.61  }
    3.62 @@ -381,8 +390,7 @@
    3.63      SDL_Touch *touch = SDL_GetTouch(id);
    3.64      SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
    3.65      int posted;
    3.66 -    float xrel;
    3.67 -    float yrel;
    3.68 +    Sint16 xrel, yrel;
    3.69      float x_max = 0, y_max = 0;
    3.70      
    3.71      if (!touch) {
    3.72 @@ -398,7 +406,7 @@
    3.73      }
    3.74      
    3.75      if(finger == NULL || !finger->down) {
    3.76 -	return SDL_SendFingerDown(id,fingerid,SDL_TRUE,x,y,pressure);	
    3.77 +	return SDL_SendFingerDown(id,fingerid,SDL_TRUE,xin,yin,pressurein);	
    3.78      } else {
    3.79  	/* the relative motion is calculated regarding the last position */
    3.80  	if (relative) {
    3.81 @@ -412,6 +420,7 @@
    3.82  	    if(pressurein < touch->pressure_min) pressure = finger->last_pressure;
    3.83  	    xrel = x - finger->last_x;
    3.84  	    yrel = y - finger->last_y;
    3.85 +	    //printf("xrel,yrel (%i,%i)\n",(int)xrel,(int)yrel);
    3.86  	}
    3.87  	
    3.88  	/* Drop events that don't change state */
    3.89 @@ -460,6 +469,9 @@
    3.90  	    event.tfinger.fingerId = fingerid;
    3.91  	    event.tfinger.x = x;
    3.92  	    event.tfinger.y = y;
    3.93 +	    event.tfinger.dx = xrel;
    3.94 +	    event.tfinger.dy = yrel;
    3.95 +	    
    3.96  		
    3.97  	    event.tfinger.pressure = pressure;
    3.98  	    event.tfinger.state = touch->buttonstate;
     4.1 --- a/src/video/x11/SDL_eventtouch.c	Tue Aug 03 00:18:00 2010 -0400
     4.2 +++ b/src/video/x11/SDL_eventtouch.c	Wed Aug 04 23:17:30 2010 -0400
     4.3 @@ -61,6 +61,14 @@
     4.4  
     4.5  	touch.driverdata = SDL_malloc(sizeof(EventTouchData));
     4.6  	EventTouchData* data = (EventTouchData*)(touch.driverdata);
     4.7 +
     4.8 +	data->x = -1;
     4.9 +	data->y = -1;
    4.10 +	data->pressure = -1;
    4.11 +	data->finger = 0;
    4.12 +	data->up = SDL_FALSE;
    4.13 +	
    4.14 +
    4.15  	printf("Opening device...\n");
    4.16  	//printf("New Touch - DataPtr: %i\n",data);
    4.17  	data->eventStream = open(tstr, 
     5.1 --- a/src/video/x11/SDL_x11events.c	Tue Aug 03 00:18:00 2010 -0400
     5.2 +++ b/src/video/x11/SDL_x11events.c	Wed Aug 04 23:17:30 2010 -0400
     5.3 @@ -439,8 +439,8 @@
     5.4  			    if(data->pressure < 0) data->pressure = 0;
     5.5  			    break;
     5.6  			case ABS_MISC:
     5.7 -			    data->up = SDL_TRUE;
     5.8 -			    data->finger = ev[i].value;
     5.9 +			    if(ev[i].value == 0)
    5.10 +			        data->up = SDL_TRUE;			    
    5.11  			    break;
    5.12  			}
    5.13  		    break;
    5.14 @@ -453,22 +453,22 @@
    5.15  		  if(data->up) {
    5.16  		      SDL_SendFingerDown(touch->id,data->finger,
    5.17  			  	       SDL_FALSE,data->x,data->y,
    5.18 -				       data->pressure);
    5.19 +				       data->pressure);		    
    5.20  		  }
    5.21  		  else if(data->x >= 0 || data->y >= 0)
    5.22 -		      SDL_SendTouchMotion(touch->id,data->finger, 
    5.23 +		    SDL_SendTouchMotion(touch->id,data->finger, 
    5.24  					SDL_FALSE,data->x,data->y,
    5.25 -					    data->pressure);
    5.26 +					data->pressure);
    5.27  		  
    5.28  		    //printf("Synched: %i tx: %i, ty: %i\n",
    5.29  		    //	   data->finger,data->x,data->y);
    5.30 -		    data->x = -1;
    5.31 -		    data->y = -1;
    5.32 -		    data->pressure = -1;
    5.33 -		    data->finger = 0;
    5.34 -		    data->up = SDL_FALSE;
    5.35 +		  data->x = -1;
    5.36 +		  data->y = -1;
    5.37 +		  data->pressure = -1;
    5.38 +		  data->finger = 0;
    5.39 +		  data->up = SDL_FALSE;
    5.40  		    
    5.41 -		    break;		
    5.42 +		  break;		
    5.43  		}
    5.44  	    }
    5.45  	}
     6.1 --- a/touchTest/gestureSDLTest.c	Tue Aug 03 00:18:00 2010 -0400
     6.2 +++ b/touchTest/gestureSDLTest.c	Wed Aug 04 23:17:30 2010 -0400
     6.3 @@ -414,11 +414,14 @@
     6.4  	    */
     6.5  	    break;
     6.6  	  case SDL_MULTIGESTURE:
     6.7 +	    /*
     6.8  	    printf("Multi Gesture: x = %f, y = %f, dAng = %f, dR = %f\n",
     6.9  		   event.mgesture.x,
    6.10  		   event.mgesture.y,
    6.11  		   event.mgesture.dTheta,
    6.12  		   event.mgesture.dDist);
    6.13 +	    printf("MG: numDownTouch = %i\n",event.mgesture.numFingers);
    6.14 +	    */
    6.15  	    knob.p.x = event.mgesture.x;
    6.16  	    knob.p.y = event.mgesture.y;
    6.17  	    knob.ang += event.mgesture.dTheta;
    6.18 @@ -435,9 +438,9 @@
    6.19  	  }
    6.20        }
    6.21      DrawScreen(screen,h);    
    6.22 -    for(i = 0; i < 256; i++) 
    6.23 -      if(keystat[i]) 
    6.24 -	printf("Key %i down\n",i);
    6.25 +    //for(i = 0; i < 256; i++) 
    6.26 +    //  if(keystat[i]) 
    6.27 +    //  printf("Key %i down\n",i);
    6.28    }  
    6.29    SDL_Quit();
    6.30