Update VS2010 project to add new files; update new files so code builds on Win32/Win64
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Mon, 23 Aug 2010 23:44:28 -0700
changeset 488027c458e4ae31
parent 4864 ebcb4988b16f
child 5075 bcc293edbcf3
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
VisualC/SDL/SDL_VS2010.vcxproj
src/audio/SDL_audio.c
src/events/SDL_gesture.c
src/events/SDL_touch.c
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32keyboard.c
     1.1 --- a/VisualC/SDL/SDL_VS2010.vcxproj	Sun Aug 22 17:19:10 2010 -0700
     1.2 +++ b/VisualC/SDL/SDL_VS2010.vcxproj	Mon Aug 23 23:44:28 2010 -0700
     1.3 @@ -110,7 +110,7 @@
     1.4        <Culture>0x0409</Culture>
     1.5      </ResourceCompile>
     1.6      <Link>
     1.7 -      <AdditionalDependencies>msvcrt.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
     1.8 +      <AdditionalDependencies>msvcrt.lib;msimg32.lib;version.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
     1.9        <OutputFile>$(IntDir)SDL.dll</OutputFile>
    1.10        <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
    1.11        <GenerateDebugInformation>true</GenerateDebugInformation>
    1.12 @@ -274,6 +274,9 @@
    1.13      <ClInclude Include="..\..\src\events\blank_cursor.h" />
    1.14      <ClInclude Include="..\..\src\events\default_cursor.h" />
    1.15      <ClInclude Include="..\..\src\audio\windx5\directx.h" />
    1.16 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
    1.17 +    <ClInclude Include="..\..\src\events\SDL_gesture_c.h" />
    1.18 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
    1.19      <ClInclude Include="..\..\src\libm\math.h" />
    1.20      <ClInclude Include="..\..\src\libm\math_private.h" />
    1.21      <ClInclude Include="..\..\src\video\mmx.h" />
    1.22 @@ -326,6 +329,7 @@
    1.23      <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
    1.24      <ClInclude Include="..\..\src\video\win32\SDL_vkeys.h" />
    1.25      <ClInclude Include="..\..\src\audio\SDL_wave.h" />
    1.26 +    <ClInclude Include="..\..\src\video\win32\SDL_win32clipboard.h" />
    1.27      <ClInclude Include="..\..\src\video\win32\SDL_win32events.h" />
    1.28      <ClInclude Include="..\..\src\video\win32\SDL_win32gamma.h" />
    1.29      <ClInclude Include="..\..\src\video\win32\SDL_win32keyboard.h" />
    1.30 @@ -340,6 +344,9 @@
    1.31      <ClInclude Include="..\..\src\video\win32\wmmsg.h" />
    1.32    </ItemGroup>
    1.33    <ItemGroup>
    1.34 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
    1.35 +    <ClCompile Include="..\..\src\events\SDL_gesture.c" />
    1.36 +    <ClCompile Include="..\..\src\events\SDL_touch.c" />
    1.37      <ClCompile Include="..\..\src\libm\e_log.c" />
    1.38      <ClCompile Include="..\..\src\libm\e_pow.c" />
    1.39      <ClCompile Include="..\..\src\libm\e_rem_pio2.c" />
    1.40 @@ -431,6 +438,7 @@
    1.41      <ClCompile Include="..\..\src\timer\SDL_timer.c" />
    1.42      <ClCompile Include="..\..\src\video\SDL_video.c" />
    1.43      <ClCompile Include="..\..\src\audio\SDL_wave.c" />
    1.44 +    <ClCompile Include="..\..\src\video\win32\SDL_win32clipboard.c" />
    1.45      <ClCompile Include="..\..\src\video\win32\SDL_win32events.c" />
    1.46      <ClCompile Include="..\..\src\video\win32\SDL_win32gamma.c" />
    1.47      <ClCompile Include="..\..\src\video\win32\SDL_win32keyboard.c" />
     2.1 --- a/src/audio/SDL_audio.c	Sun Aug 22 17:19:10 2010 -0700
     2.2 +++ b/src/audio/SDL_audio.c	Mon Aug 23 23:44:28 2010 -0700
     2.3 @@ -29,7 +29,7 @@
     2.4  #include "SDL_audiomem.h"
     2.5  #include "SDL_sysaudio.h"
     2.6  
     2.7 -#define _THIS    SDL_AudioDevice *this
     2.8 +#define _THIS SDL_AudioDevice *t
     2.9  
    2.10  static SDL_AudioDriver current_audio;
    2.11  static SDL_AudioDevice *open_devices[16];
    2.12 @@ -321,8 +321,9 @@
    2.13      }
    2.14  }
    2.15  
    2.16 -
    2.17 +#if defined(ANDROID)
    2.18  #include <android/log.h>
    2.19 +#endif
    2.20  
    2.21  /* The general mixing thread function */
    2.22  int SDLCALL
    2.23 @@ -433,6 +434,7 @@
    2.24  
    2.25                  /* Read from the callback into the _input_ stream */
    2.26                  SDL_mutexP(device->mixer_lock);
    2.27 +				istream_len = 0;
    2.28                  (*fill) (udata, istream, istream_len);
    2.29                  SDL_mutexV(device->mixer_lock);
    2.30  
    2.31 @@ -891,7 +893,7 @@
    2.32      device->opened = 1;
    2.33  
    2.34      /* Allocate a fake audio memory buffer */
    2.35 -    device->fake_stream = SDL_AllocAudioMem(device->spec.size);
    2.36 +    device->fake_stream = (Uint8 *)SDL_AllocAudioMem(device->spec.size);
    2.37      if (device->fake_stream == NULL) {
    2.38          close_audio_device(device);
    2.39          SDL_OutOfMemory();
     3.1 --- a/src/events/SDL_gesture.c	Sun Aug 22 17:19:10 2010 -0700
     3.2 +++ b/src/events/SDL_gesture.c	Mon Aug 23 23:44:28 2010 -0700
     3.3 @@ -18,6 +18,7 @@
     3.4      Sam Lantinga
     3.5      slouken@libsdl.org
     3.6  */
     3.7 +
     3.8  #include "SDL_config.h"
     3.9  
    3.10  /* General mouse handling code for SDL */
    3.11 @@ -26,6 +27,11 @@
    3.12  #include "SDL_events_c.h"
    3.13  #include "SDL_gesture_c.h"
    3.14  
    3.15 +#include <memory.h>
    3.16 +#include <string.h>
    3.17 +#include <stdio.h>
    3.18 +#include <math.h>
    3.19 +
    3.20  //TODO: Replace with malloc
    3.21  
    3.22  #define MAXPATHSIZE 1024
    3.23 @@ -100,8 +106,8 @@
    3.24    unsigned long hash = 5381;
    3.25    int i;
    3.26    for(i = 0;i < DOLLARNPOINTS; i++) { 
    3.27 -    hash = ((hash<<5) + hash) + points[i].x;
    3.28 -    hash = ((hash<<5) + hash) + points[i].y;
    3.29 +    hash = ((hash<<5) + hash) + (unsigned long)points[i].x;
    3.30 +    hash = ((hash<<5) + hash) + (unsigned long)points[i].y;
    3.31    }
    3.32    return hash;
    3.33  }
    3.34 @@ -110,7 +116,6 @@
    3.35  static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) {
    3.36    if(src == NULL) return 0;
    3.37  
    3.38 -  int i;
    3.39    
    3.40    //No Longer storing the Hash, rehash on load
    3.41    //if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0;
    3.42 @@ -151,14 +156,16 @@
    3.43  //path is an already sampled set of points
    3.44  //Returns the index of the gesture on success, or -1
    3.45  static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path) {
    3.46 +  SDL_DollarTemplate* dollarTemplate;
    3.47 +  SDL_DollarTemplate *templ;
    3.48 +  int i = 0;
    3.49    if(inTouch == NULL) {
    3.50      if(SDL_numGestureTouches == 0) return -1;
    3.51 -    int i = 0;
    3.52      for(i = 0;i < SDL_numGestureTouches; i++) {
    3.53        inTouch = &SDL_gestureTouch[i];
    3.54  
    3.55 -      SDL_DollarTemplate* dollarTemplate = 
    3.56 -	SDL_realloc(inTouch->dollarTemplate,
    3.57 +    dollarTemplate = 
    3.58 +	(SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
    3.59  		    (inTouch->numDollarTemplates + 1) * 
    3.60  		    sizeof(SDL_DollarTemplate));
    3.61        if(!dollarTemplate) {
    3.62 @@ -168,7 +175,7 @@
    3.63  	
    3.64        inTouch->dollarTemplate = dollarTemplate;
    3.65  
    3.66 -      SDL_DollarTemplate *templ = 
    3.67 +    templ = 
    3.68  	&inTouch->dollarTemplate[inTouch->numDollarTemplates];
    3.69        memcpy(templ->path,path,DOLLARNPOINTS*sizeof(SDL_FloatPoint));
    3.70        templ->hash = SDL_HashDollar(templ->path);
    3.71 @@ -177,7 +184,7 @@
    3.72      return inTouch->numDollarTemplates - 1;
    3.73    } else {
    3.74      SDL_DollarTemplate* dollarTemplate = 
    3.75 -      SDL_realloc(inTouch->dollarTemplate,
    3.76 +      ( SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
    3.77  		  (inTouch->numDollarTemplates + 1) * 
    3.78  		  sizeof(SDL_DollarTemplate));
    3.79      if(!dollarTemplate) {
    3.80 @@ -187,7 +194,7 @@
    3.81      
    3.82      inTouch->dollarTemplate = dollarTemplate;
    3.83  
    3.84 -    SDL_DollarTemplate *templ = 
    3.85 +    templ = 
    3.86        &inTouch->dollarTemplate[inTouch->numDollarTemplates];
    3.87      memcpy(templ->path,path,DOLLARNPOINTS*sizeof(SDL_FloatPoint));
    3.88      templ->hash = SDL_HashDollar(templ->path);
    3.89 @@ -198,9 +205,9 @@
    3.90  }
    3.91  
    3.92  int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
    3.93 -  if(src == NULL) return 0;
    3.94    int i,loaded = 0;
    3.95    SDL_GestureTouch *touch = NULL;
    3.96 +  if(src == NULL) return 0;
    3.97    if(touchId >= 0) {
    3.98      for(i = 0;i < SDL_numGestureTouches; i++)
    3.99        if(SDL_gestureTouch[i].id == touchId)
   3.100 @@ -240,10 +247,10 @@
   3.101    SDL_FloatPoint p;
   3.102    int i;
   3.103    for(i = 0; i < DOLLARNPOINTS; i++) {
   3.104 -    p.x = points[i].x * cos(ang) - points[i].y * sin(ang);
   3.105 -    p.y = points[i].x * sin(ang) + points[i].y * cos(ang);
   3.106 -    dist += sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
   3.107 -		 (p.y-templ[i].y)*(p.y-templ[i].y));
   3.108 +    p.x = (float)(points[i].x * cos(ang) - points[i].y * sin(ang));
   3.109 +    p.y = (float)(points[i].x * sin(ang) + points[i].y * cos(ang));
   3.110 +    dist += (float)(sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
   3.111 +		 (p.y-templ[i].y)*(p.y-templ[i].y)));
   3.112    }
   3.113    return dist/DOLLARNPOINTS;
   3.114    
   3.115 @@ -253,26 +260,26 @@
   3.116    //------------BEGIN DOLLAR BLACKBOX----------------//
   3.117    //-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-//
   3.118    //-"http://depts.washington.edu/aimgroup/proj/dollar/"-//
   3.119 -  float ta = -M_PI/4;
   3.120 -  float tb = M_PI/4;
   3.121 -  float dt = M_PI/90;
   3.122 -  float x1 = PHI*ta + (1-PHI)*tb;
   3.123 +  double ta = -M_PI/4;
   3.124 +  double tb = M_PI/4;
   3.125 +  double dt = M_PI/90;
   3.126 +  float x1 = (float)(PHI*ta + (1-PHI)*tb);
   3.127    float f1 = dollarDifference(points,templ,x1);
   3.128 -  float x2 = (1-PHI)*ta + PHI*tb;
   3.129 +  float x2 = (float)((1-PHI)*ta + PHI*tb);
   3.130    float f2 = dollarDifference(points,templ,x2);
   3.131 -  while(abs(ta-tb) > dt) {
   3.132 +  while(fabs(ta-tb) > dt) {
   3.133      if(f1 < f2) {
   3.134        tb = x2;
   3.135        x2 = x1;
   3.136        f2 = f1;
   3.137 -      x1 = PHI*ta + (1-PHI)*tb;
   3.138 +      x1 = (float)(PHI*ta + (1-PHI)*tb);
   3.139        f1 = dollarDifference(points,templ,x1);
   3.140      }
   3.141      else {
   3.142        ta = x1;
   3.143        x1 = x2;
   3.144        f1 = f2;
   3.145 -      x2 = (1-PHI)*ta + PHI*tb;
   3.146 +      x2 = (float)((1-PHI)*ta + PHI*tb);
   3.147        f2 = dollarDifference(points,templ,x2);
   3.148      }
   3.149    }
   3.150 @@ -288,6 +295,14 @@
   3.151  //DollarPath contains raw points, plus (possibly) the calculated length
   3.152  int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
   3.153    int i;
   3.154 +  float interval;
   3.155 +  float dist;
   3.156 +  int numPoints = 0;
   3.157 +  SDL_FloatPoint centroid; 
   3.158 +  float xmin,xmax,ymin,ymax;
   3.159 +  float ang;
   3.160 +  float w,h;
   3.161 +
   3.162    //Calculate length if it hasn't already been done
   3.163    if(path.length <= 0) {
   3.164      for(i=1;i<path.numPoints;i++) {
   3.165 @@ -295,22 +310,20 @@
   3.166  	         path.p[i-1].x;
   3.167        float dy = path.p[i  ].y - 
   3.168  	         path.p[i-1].y;
   3.169 -      path.length += sqrt(dx*dx+dy*dy);
   3.170 +      path.length += (float)(sqrt(dx*dx+dy*dy));
   3.171      }
   3.172    }
   3.173  
   3.174    //Resample
   3.175 -  float interval = path.length/(DOLLARNPOINTS - 1);
   3.176 -  float dist = interval;
   3.177 +  interval = path.length/(DOLLARNPOINTS - 1);
   3.178 +  dist = interval;
   3.179  
   3.180 -  int numPoints = 0;
   3.181 -  SDL_FloatPoint centroid; 
   3.182    centroid.x = 0;centroid.y = 0;
   3.183    
   3.184    //printf("(%f,%f)\n",path.p[path.numPoints-1].x,path.p[path.numPoints-1].y);
   3.185    for(i = 1;i < path.numPoints;i++) {
   3.186 -    float d = sqrt((path.p[i-1].x-path.p[i].x)*(path.p[i-1].x-path.p[i].x)+
   3.187 -		   (path.p[i-1].y-path.p[i].y)*(path.p[i-1].y-path.p[i].y));
   3.188 +    float d = (float)(sqrt((path.p[i-1].x-path.p[i].x)*(path.p[i-1].x-path.p[i].x)+
   3.189 +		             (path.p[i-1].y-path.p[i].y)*(path.p[i-1].y-path.p[i].y)));
   3.190      //printf("d = %f dist = %f/%f\n",d,dist,interval);
   3.191      while(dist + d > interval) {
   3.192        points[numPoints].x = path.p[i-1].x + 
   3.193 @@ -338,22 +351,21 @@
   3.194   
   3.195    //printf("Centroid (%f,%f)",centroid.x,centroid.y);
   3.196    //Rotate Points so point 0 is left of centroid and solve for the bounding box
   3.197 -  float xmin,xmax,ymin,ymax;
   3.198    xmin = centroid.x;
   3.199    xmax = centroid.x;
   3.200    ymin = centroid.y;
   3.201    ymax = centroid.y;
   3.202    
   3.203 -  float ang = atan2(centroid.y - points[0].y,
   3.204 -		    centroid.x - points[0].x);
   3.205 +  ang = (float)(atan2(centroid.y - points[0].y,
   3.206 +		    centroid.x - points[0].x));
   3.207  
   3.208    for(i = 0;i<numPoints;i++) {					       
   3.209      float px = points[i].x;
   3.210      float py = points[i].y;
   3.211 -    points[i].x = (px - centroid.x)*cos(ang) - 
   3.212 -                  (py - centroid.y)*sin(ang) + centroid.x;
   3.213 -    points[i].y = (px - centroid.x)*sin(ang) + 
   3.214 -                  (py - centroid.y)*cos(ang) + centroid.y;
   3.215 +    points[i].x = (float)((px - centroid.x)*cos(ang) - 
   3.216 +                  (py - centroid.y)*sin(ang) + centroid.x);
   3.217 +    points[i].y = (float)((px - centroid.x)*sin(ang) + 
   3.218 +                  (py - centroid.y)*cos(ang) + centroid.y);
   3.219  
   3.220  
   3.221      if(points[i].x < xmin) xmin = points[i].x;
   3.222 @@ -363,8 +375,8 @@
   3.223    }
   3.224  
   3.225    //Scale points to DOLLARSIZE, and translate to the origin
   3.226 -  float w = xmax-xmin;
   3.227 -  float h = ymax-ymin;
   3.228 +  w = xmax-xmin;
   3.229 +  h = ymax-ymin;
   3.230  
   3.231    for(i=0;i<numPoints;i++) {
   3.232      points[i].x = (points[i].x - centroid.x)*DOLLARSIZE/w;
   3.233 @@ -380,17 +392,17 @@
   3.234  	//SDL_PrintPath(points);
   3.235  	int i;
   3.236  	
   3.237 -	int bestDiff = 10000;
   3.238 +	float bestDiff = 10000;
   3.239  	*bestTempl = -1;
   3.240  	for(i = 0;i < touch->numDollarTemplates;i++) {
   3.241 -		int diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
   3.242 +		float diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
   3.243  		if(diff < bestDiff) {bestDiff = diff; *bestTempl = i;}
   3.244  	}
   3.245  	return bestDiff;
   3.246  }
   3.247  
   3.248  int SDL_GestureAddTouch(SDL_Touch* touch) {  
   3.249 -  SDL_GestureTouch *gestureTouch = SDL_realloc(SDL_gestureTouch,
   3.250 +  SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
   3.251  					       (SDL_numGestureTouches + 1) *
   3.252  					       sizeof(SDL_GestureTouch));
   3.253  
   3.254 @@ -479,6 +491,18 @@
   3.255  
   3.256  void SDL_GestureProcessEvent(SDL_Event* event)
   3.257  {
   3.258 +  float x,y; 
   3.259 +  SDL_FloatPoint path[DOLLARNPOINTS];
   3.260 +  int index;
   3.261 +  int i;
   3.262 +  float pathDx, pathDy;
   3.263 +  SDL_FloatPoint lastP;
   3.264 +  SDL_FloatPoint lastCentroid;
   3.265 +  float lDist;
   3.266 +  float Dist;
   3.267 +  float dtheta;
   3.268 +  float dDist;
   3.269 +
   3.270    if(event->type == SDL_FINGERMOTION || 
   3.271       event->type == SDL_FINGERDOWN ||
   3.272       event->type == SDL_FINGERUP) {
   3.273 @@ -492,8 +516,8 @@
   3.274      //   (int)inTouch->res.x,(int)inTouch->res.y);
   3.275  
   3.276      
   3.277 -    float x = ((float)event->tfinger.x)/(float)inTouch->res.x;
   3.278 -    float y = ((float)event->tfinger.y)/(float)inTouch->res.y;   
   3.279 +    x = ((float)event->tfinger.x)/(float)inTouch->res.x;
   3.280 +    y = ((float)event->tfinger.y)/(float)inTouch->res.y;   
   3.281  
   3.282  
   3.283      //Finger Up
   3.284 @@ -502,14 +526,11 @@
   3.285        
   3.286  #ifdef ENABLE_DOLLAR
   3.287        if(inTouch->recording) {
   3.288 -	inTouch->recording = SDL_FALSE;
   3.289 -	SDL_FloatPoint path[DOLLARNPOINTS];
   3.290 +	inTouch->recording = SDL_FALSE;	
   3.291  	dollarNormalize(inTouch->dollarPath,path);
   3.292  	//SDL_PrintPath(path);
   3.293 -	int index;
   3.294  	if(recordAll) {
   3.295  	  index = SDL_AddDollarGesture(NULL,path);
   3.296 -	  int i;
   3.297  	  for(i = 0;i < SDL_numGestureTouches; i++)
   3.298  	    SDL_gestureTouch[i].recording = SDL_FALSE;
   3.299  	}
   3.300 @@ -554,18 +575,16 @@
   3.301        if(path->numPoints < MAXPATHSIZE) {
   3.302  	path->p[path->numPoints].x = inTouch->centroid.x;
   3.303  	path->p[path->numPoints].y = inTouch->centroid.y;
   3.304 -	float pathDx = 
   3.305 +	pathDx = 
   3.306  	  (path->p[path->numPoints].x-path->p[path->numPoints-1].x);
   3.307 -	float pathDy = 
   3.308 +	pathDy = 
   3.309  	  (path->p[path->numPoints].y-path->p[path->numPoints-1].y);
   3.310 -	path->length += sqrt(pathDx*pathDx + pathDy*pathDy);
   3.311 +	path->length += (float)sqrt(pathDx*pathDx + pathDy*pathDy);
   3.312  	path->numPoints++;
   3.313        }
   3.314  #endif
   3.315 -      SDL_FloatPoint lastP;
   3.316        lastP.x = x - dx;
   3.317        lastP.y = y - dy;
   3.318 -      SDL_FloatPoint lastCentroid;
   3.319        lastCentroid = inTouch->centroid;
   3.320        
   3.321        inTouch->centroid.x += dx/inTouch->numDownFingers;
   3.322 @@ -577,12 +596,12 @@
   3.323  	//lv = inTouch->gestureLast[j].cv;
   3.324  	lv.x = lastP.x - lastCentroid.x;
   3.325  	lv.y = lastP.y - lastCentroid.y;
   3.326 -	float lDist = sqrt(lv.x*lv.x + lv.y*lv.y);
   3.327 +	lDist = (float)sqrt(lv.x*lv.x + lv.y*lv.y);
   3.328  	//printf("lDist = %f\n",lDist);
   3.329  	v.x = x - inTouch->centroid.x;
   3.330  	v.y = y - inTouch->centroid.y;
   3.331  	//inTouch->gestureLast[j].cv = v;
   3.332 -	float Dist = sqrt(v.x*v.x+v.y*v.y);
   3.333 +	Dist = (float)sqrt(v.x*v.x+v.y*v.y);
   3.334  	// cos(dTheta) = (v . lv)/(|v| * |lv|)
   3.335  	
   3.336  	//Normalize Vectors to simplify angle calculation
   3.337 @@ -590,9 +609,9 @@
   3.338  	lv.y/=lDist;
   3.339  	v.x/=Dist;
   3.340  	v.y/=Dist;
   3.341 -	float dtheta = atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
   3.342 +	dtheta = (float)atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
   3.343  	
   3.344 -	float dDist = (Dist - lDist);
   3.345 +	dDist = (Dist - lDist);
   3.346  	if(lDist == 0) {dDist = 0;dtheta = 0;} //To avoid impossible values
   3.347  	
   3.348  	//inTouch->gestureLast[j].dDist = dDist;
     4.1 --- a/src/events/SDL_touch.c	Sun Aug 22 17:19:10 2010 -0700
     4.2 +++ b/src/events/SDL_touch.c	Mon Aug 23 23:44:28 2010 -0700
     4.3 @@ -313,6 +313,11 @@
     4.4  		   float xin, float yin, float pressurein)
     4.5  {
     4.6      int posted;
     4.7 +	Uint16 x;
     4.8 +	Uint16 y;
     4.9 +	Uint16 pressure;
    4.10 +	SDL_Finger *finger;
    4.11 +
    4.12      SDL_Touch* touch = SDL_GetTouch(id);
    4.13  
    4.14      if(!touch) {
    4.15 @@ -321,11 +326,11 @@
    4.16  
    4.17      
    4.18      //scale to Integer coordinates
    4.19 -    Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
    4.20 -    Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
    4.21 -    Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
    4.22 +    x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres));
    4.23 +    y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres));
    4.24 +    pressure = (Uint16)((yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres));
    4.25      
    4.26 -    SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
    4.27 +    finger = SDL_GetFinger(touch,fingerid);
    4.28      if(down) {
    4.29  	if(finger == NULL) {
    4.30  	    SDL_Finger nf;
    4.31 @@ -393,15 +398,18 @@
    4.32      int posted;
    4.33      Sint16 xrel, yrel;
    4.34      float x_max = 0, y_max = 0;
    4.35 +	Uint16 x;
    4.36 +	Uint16 y;
    4.37 +	Uint16 pressure;
    4.38      
    4.39      if (!touch) {
    4.40        return SDL_TouchNotFoundError(id);
    4.41      }
    4.42  
    4.43      //scale to Integer coordinates
    4.44 -    Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
    4.45 -    Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
    4.46 -    Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
    4.47 +    x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres));
    4.48 +    y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres));
    4.49 +    pressure = (Uint16)((yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres));
    4.50      if(touch->flush_motion) {
    4.51  	return 0;
    4.52      }
    4.53 @@ -544,9 +552,9 @@
    4.54  }
    4.55  
    4.56  int SDL_TouchNotFoundError(SDL_TouchID id) {
    4.57 +  int i;
    4.58    printf("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id);
    4.59    printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
    4.60 -  int i;
    4.61    for(i=0;i < SDL_num_touch;i++) {
    4.62      printf("ERROR: %li\n",SDL_touchPads[i]->id);
    4.63    }
     5.1 --- a/src/video/win32/SDL_win32events.c	Sun Aug 22 17:19:10 2010 -0700
     5.2 +++ b/src/video/win32/SDL_win32events.c	Mon Aug 23 23:44:28 2010 -0700
     5.3 @@ -25,6 +25,10 @@
     5.4  #define _WIN32_WINNT 0x601
     5.5  #endif
     5.6  
     5.7 +// disable deprecation of fopen()
     5.8 +#define _CRT_SECURE_NO_WARNINGS
     5.9 +#define _CRT_SECURE_NO_DEPRECATE 
    5.10 +
    5.11  #include "SDL_config.h"
    5.12  
    5.13  #include "SDL_win32video.h"
    5.14 @@ -33,8 +37,6 @@
    5.15  #include "SDL_vkeys.h"
    5.16  #include "../../events/SDL_events_c.h"
    5.17  
    5.18 -
    5.19 -
    5.20  #define WMMSG_DEBUG
    5.21  #ifdef WMMSG_DEBUG
    5.22  #include <stdio.h>	
     6.1 --- a/src/video/win32/SDL_win32keyboard.c	Sun Aug 22 17:19:10 2010 -0700
     6.2 +++ b/src/video/win32/SDL_win32keyboard.c	Mon Aug 23 23:44:28 2010 -0700
     6.3 @@ -28,6 +28,7 @@
     6.4  
     6.5  #include <imm.h>
     6.6  #include <oleauto.h>
     6.7 +#include <winver.h>
     6.8  
     6.9  static void IME_Init(SDL_VideoData *videodata, HWND hwnd);
    6.10  static void IME_Enable(SDL_VideoData *videodata, HWND hwnd);
    6.11 @@ -246,7 +247,7 @@
    6.12      videodata->ime_hwnd_main = hwnd;
    6.13      if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) {
    6.14          videodata->ime_com_initialized = SDL_TRUE;
    6.15 -        CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, &videodata->ime_threadmgr);
    6.16 +        CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr);
    6.17      }
    6.18      videodata->ime_initialized = SDL_TRUE;
    6.19      videodata->ime_himm32 = LoadLibraryA("imm32.dll");
    6.20 @@ -260,8 +261,10 @@
    6.21      videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))GetProcAddress(videodata->ime_himm32, "ImmUnlockIMCC");
    6.22  
    6.23      IME_SetWindow(videodata, hwnd);
    6.24 +#ifdef _WIN32_WCE 
    6.25      videodata->ime_himc = ImmGetContext(hwnd);
    6.26      ImmReleaseContext(hwnd, videodata->ime_himc);
    6.27 +#endif
    6.28      if (!videodata->ime_himc) {
    6.29          videodata->ime_available = SDL_FALSE;
    6.30          IME_Disable(videodata, hwnd);
    6.31 @@ -285,8 +288,10 @@
    6.32          IME_Disable(videodata, hwnd);
    6.33          return;
    6.34      }
    6.35 -    if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
    6.36 +#ifdef _WIN32_WCE 
    6.37 +	if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
    6.38          ImmAssociateContext(videodata->ime_hwnd_current, videodata->ime_himc);
    6.39 +#endif
    6.40  
    6.41      videodata->ime_enabled = SDL_TRUE;
    6.42      IME_UpdateInputLocale(videodata);
    6.43 @@ -300,8 +305,10 @@
    6.44          return;
    6.45  
    6.46      IME_ClearComposition(videodata);
    6.47 +#ifdef _WIN32_WCE 
    6.48      if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
    6.49          ImmAssociateContext(videodata->ime_hwnd_current, NULL);
    6.50 +#endif
    6.51  
    6.52      videodata->ime_enabled = SDL_FALSE;
    6.53      UILess_DisableUIUpdates(videodata);
    6.54 @@ -314,8 +321,10 @@
    6.55          return;
    6.56  
    6.57      UILess_ReleaseSinks(videodata);
    6.58 +#ifdef _WIN32_WCE 
    6.59      if (videodata->ime_hwnd_main)
    6.60          ImmAssociateContext(videodata->ime_hwnd_main, videodata->ime_himc);
    6.61 +#endif
    6.62  
    6.63      videodata->ime_hwnd_main = 0;
    6.64      videodata->ime_himc = 0;
    6.65 @@ -358,9 +367,11 @@
    6.66      if (!id)
    6.67          return;
    6.68  
    6.69 +#ifdef _WIN32_WCE 
    6.70      himc = ImmGetContext(hwnd);
    6.71      if (!himc)
    6.72          return;
    6.73 +#endif
    6.74  
    6.75      if (videodata->GetReadingString) {
    6.76          len = videodata->GetReadingString(himc, 0, 0, &err, &vertical, &maxuilen);
    6.77 @@ -431,7 +442,9 @@
    6.78          videodata->ImmUnlockIMCC(lpimc->hPrivate);
    6.79          videodata->ImmUnlockIMC(himc);
    6.80      }
    6.81 +#ifdef _WIN32_WCE 
    6.82      ImmReleaseContext(hwnd, himc);
    6.83 +#endif
    6.84      IME_SendEditingEvent(videodata);
    6.85  }
    6.86  
    6.87 @@ -445,11 +458,13 @@
    6.88      if (lang != PRIMLANG()) {
    6.89          IME_ClearComposition(videodata);
    6.90      }
    6.91 +#ifdef _WIN32_WCE 
    6.92      hwndime = ImmGetDefaultIMEWnd(videodata->ime_hwnd_current);
    6.93      if (hwndime) {
    6.94          SendMessageA(hwndime, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0);
    6.95          SendMessageA(hwndime, WM_IME_CONTROL, IMC_CLOSESTATUSWINDOW, 0);
    6.96      }
    6.97 +#endif
    6.98  }
    6.99  
   6.100  static DWORD
   6.101 @@ -487,11 +502,13 @@
   6.102          dwRet[0] = dwRet[1] = 0;
   6.103          return dwRet[uIndex];
   6.104      }
   6.105 +#ifdef _WIN32_WCE 
   6.106      if (ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1) <= 0) {
   6.107          dwRet[0] = dwRet[1] = 0;
   6.108          return dwRet[uIndex];
   6.109      }
   6.110 -    if (!videodata->GetReadingString) {
   6.111 +#endif
   6.112 +	if (!videodata->GetReadingString) {
   6.113          #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
   6.114          if (CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME1, -1) != 2
   6.115              && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME2, -1) != 2
   6.116 @@ -553,8 +570,10 @@
   6.117          return;
   6.118  
   6.119      hkl = videodata->ime_hkl;
   6.120 -    if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0)
   6.121 +#ifdef _WIN32_WCE 
   6.122 +	if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0)
   6.123          return;
   6.124 +#endif
   6.125  
   6.126      hime = LoadLibraryA(ime_file);
   6.127      if (!hime)
   6.128 @@ -565,13 +584,15 @@
   6.129      videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL))
   6.130          GetProcAddress(hime, "ShowReadingWindow");
   6.131  
   6.132 +#ifdef _WIN32_WCE 
   6.133      if (videodata->ShowReadingWindow) {
   6.134          HIMC himc = ImmGetContext(videodata->ime_hwnd_current);
   6.135          if (himc) {
   6.136 -            videodata->ShowReadingWindow(himc, FALSE);
   6.137 +			videodata->ShowReadingWindow(himc, FALSE);
   6.138              ImmReleaseContext(videodata->ime_hwnd_current, himc);
   6.139          }
   6.140      }
   6.141 +#endif
   6.142  }
   6.143  
   6.144  static void
   6.145 @@ -605,6 +626,7 @@
   6.146      if (!videodata->ime_initialized)
   6.147          return;
   6.148  
   6.149 +#ifdef _WIN32_WCE 
   6.150      himc = ImmGetContext(videodata->ime_hwnd_current);
   6.151      if (!himc)
   6.152          return;
   6.153 @@ -615,6 +637,7 @@
   6.154  
   6.155      ImmNotifyIME(himc, NI_CLOSECANDIDATE, 0, 0);
   6.156      ImmReleaseContext(videodata->ime_hwnd_current, himc);
   6.157 +#endif
   6.158      SDL_SendEditingText("", 0, 0);
   6.159  }
   6.160  
   6.161 @@ -697,6 +720,7 @@
   6.162          break;
   6.163      case WM_IME_COMPOSITION:
   6.164          trap = SDL_TRUE;
   6.165 +#ifdef _WIN32_WCE 
   6.166          himc = ImmGetContext(hwnd);
   6.167          if (*lParam & GCS_RESULTSTR) {
   6.168              IME_GetCompositionString(videodata, himc, GCS_RESULTSTR);
   6.169 @@ -710,6 +734,7 @@
   6.170              IME_SendEditingEvent(videodata);
   6.171          }
   6.172          ImmReleaseContext(hwnd, himc);
   6.173 +#endif
   6.174          break;
   6.175      case WM_IME_ENDCOMPOSITION:
   6.176          videodata->ime_composition[0] = 0;