Update VS2010 project to add new files; update new files so code builds on Win32/Win64
--- a/VisualC/SDL/SDL_VS2010.vcxproj Sun Aug 22 17:19:10 2010 -0700
+++ b/VisualC/SDL/SDL_VS2010.vcxproj Mon Aug 23 23:44:28 2010 -0700
@@ -110,7 +110,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>msvcrt.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>msvcrt.lib;msimg32.lib;version.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(IntDir)SDL.dll</OutputFile>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -274,6 +274,9 @@
<ClInclude Include="..\..\src\events\blank_cursor.h" />
<ClInclude Include="..\..\src\events\default_cursor.h" />
<ClInclude Include="..\..\src\audio\windx5\directx.h" />
+ <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
+ <ClInclude Include="..\..\src\events\SDL_gesture_c.h" />
+ <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\libm\math.h" />
<ClInclude Include="..\..\src\libm\math_private.h" />
<ClInclude Include="..\..\src\video\mmx.h" />
@@ -326,6 +329,7 @@
<ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
<ClInclude Include="..\..\src\video\win32\SDL_vkeys.h" />
<ClInclude Include="..\..\src\audio\SDL_wave.h" />
+ <ClInclude Include="..\..\src\video\win32\SDL_win32clipboard.h" />
<ClInclude Include="..\..\src\video\win32\SDL_win32events.h" />
<ClInclude Include="..\..\src\video\win32\SDL_win32gamma.h" />
<ClInclude Include="..\..\src\video\win32\SDL_win32keyboard.h" />
@@ -340,6 +344,9 @@
<ClInclude Include="..\..\src\video\win32\wmmsg.h" />
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
+ <ClCompile Include="..\..\src\events\SDL_gesture.c" />
+ <ClCompile Include="..\..\src\events\SDL_touch.c" />
<ClCompile Include="..\..\src\libm\e_log.c" />
<ClCompile Include="..\..\src\libm\e_pow.c" />
<ClCompile Include="..\..\src\libm\e_rem_pio2.c" />
@@ -431,6 +438,7 @@
<ClCompile Include="..\..\src\timer\SDL_timer.c" />
<ClCompile Include="..\..\src\video\SDL_video.c" />
<ClCompile Include="..\..\src\audio\SDL_wave.c" />
+ <ClCompile Include="..\..\src\video\win32\SDL_win32clipboard.c" />
<ClCompile Include="..\..\src\video\win32\SDL_win32events.c" />
<ClCompile Include="..\..\src\video\win32\SDL_win32gamma.c" />
<ClCompile Include="..\..\src\video\win32\SDL_win32keyboard.c" />
--- a/src/audio/SDL_audio.c Sun Aug 22 17:19:10 2010 -0700
+++ b/src/audio/SDL_audio.c Mon Aug 23 23:44:28 2010 -0700
@@ -29,7 +29,7 @@
#include "SDL_audiomem.h"
#include "SDL_sysaudio.h"
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *t
static SDL_AudioDriver current_audio;
static SDL_AudioDevice *open_devices[16];
@@ -321,8 +321,9 @@
}
}
-
+#if defined(ANDROID)
#include <android/log.h>
+#endif
/* The general mixing thread function */
int SDLCALL
@@ -433,6 +434,7 @@
/* Read from the callback into the _input_ stream */
SDL_mutexP(device->mixer_lock);
+ istream_len = 0;
(*fill) (udata, istream, istream_len);
SDL_mutexV(device->mixer_lock);
@@ -891,7 +893,7 @@
device->opened = 1;
/* Allocate a fake audio memory buffer */
- device->fake_stream = SDL_AllocAudioMem(device->spec.size);
+ device->fake_stream = (Uint8 *)SDL_AllocAudioMem(device->spec.size);
if (device->fake_stream == NULL) {
close_audio_device(device);
SDL_OutOfMemory();
--- a/src/events/SDL_gesture.c Sun Aug 22 17:19:10 2010 -0700
+++ b/src/events/SDL_gesture.c Mon Aug 23 23:44:28 2010 -0700
@@ -18,6 +18,7 @@
Sam Lantinga
slouken@libsdl.org
*/
+
#include "SDL_config.h"
/* General mouse handling code for SDL */
@@ -26,6 +27,11 @@
#include "SDL_events_c.h"
#include "SDL_gesture_c.h"
+#include <memory.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
//TODO: Replace with malloc
#define MAXPATHSIZE 1024
@@ -100,8 +106,8 @@
unsigned long hash = 5381;
int i;
for(i = 0;i < DOLLARNPOINTS; i++) {
- hash = ((hash<<5) + hash) + points[i].x;
- hash = ((hash<<5) + hash) + points[i].y;
+ hash = ((hash<<5) + hash) + (unsigned long)points[i].x;
+ hash = ((hash<<5) + hash) + (unsigned long)points[i].y;
}
return hash;
}
@@ -110,7 +116,6 @@
static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) {
if(src == NULL) return 0;
- int i;
//No Longer storing the Hash, rehash on load
//if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0;
@@ -151,14 +156,16 @@
//path is an already sampled set of points
//Returns the index of the gesture on success, or -1
static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path) {
+ SDL_DollarTemplate* dollarTemplate;
+ SDL_DollarTemplate *templ;
+ int i = 0;
if(inTouch == NULL) {
if(SDL_numGestureTouches == 0) return -1;
- int i = 0;
for(i = 0;i < SDL_numGestureTouches; i++) {
inTouch = &SDL_gestureTouch[i];
- SDL_DollarTemplate* dollarTemplate =
- SDL_realloc(inTouch->dollarTemplate,
+ dollarTemplate =
+ (SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
(inTouch->numDollarTemplates + 1) *
sizeof(SDL_DollarTemplate));
if(!dollarTemplate) {
@@ -168,7 +175,7 @@
inTouch->dollarTemplate = dollarTemplate;
- SDL_DollarTemplate *templ =
+ templ =
&inTouch->dollarTemplate[inTouch->numDollarTemplates];
memcpy(templ->path,path,DOLLARNPOINTS*sizeof(SDL_FloatPoint));
templ->hash = SDL_HashDollar(templ->path);
@@ -177,7 +184,7 @@
return inTouch->numDollarTemplates - 1;
} else {
SDL_DollarTemplate* dollarTemplate =
- SDL_realloc(inTouch->dollarTemplate,
+ ( SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
(inTouch->numDollarTemplates + 1) *
sizeof(SDL_DollarTemplate));
if(!dollarTemplate) {
@@ -187,7 +194,7 @@
inTouch->dollarTemplate = dollarTemplate;
- SDL_DollarTemplate *templ =
+ templ =
&inTouch->dollarTemplate[inTouch->numDollarTemplates];
memcpy(templ->path,path,DOLLARNPOINTS*sizeof(SDL_FloatPoint));
templ->hash = SDL_HashDollar(templ->path);
@@ -198,9 +205,9 @@
}
int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
- if(src == NULL) return 0;
int i,loaded = 0;
SDL_GestureTouch *touch = NULL;
+ if(src == NULL) return 0;
if(touchId >= 0) {
for(i = 0;i < SDL_numGestureTouches; i++)
if(SDL_gestureTouch[i].id == touchId)
@@ -240,10 +247,10 @@
SDL_FloatPoint p;
int i;
for(i = 0; i < DOLLARNPOINTS; i++) {
- p.x = points[i].x * cos(ang) - points[i].y * sin(ang);
- p.y = points[i].x * sin(ang) + points[i].y * cos(ang);
- dist += sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
- (p.y-templ[i].y)*(p.y-templ[i].y));
+ p.x = (float)(points[i].x * cos(ang) - points[i].y * sin(ang));
+ p.y = (float)(points[i].x * sin(ang) + points[i].y * cos(ang));
+ dist += (float)(sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
+ (p.y-templ[i].y)*(p.y-templ[i].y)));
}
return dist/DOLLARNPOINTS;
@@ -253,26 +260,26 @@
//------------BEGIN DOLLAR BLACKBOX----------------//
//-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-//
//-"http://depts.washington.edu/aimgroup/proj/dollar/"-//
- float ta = -M_PI/4;
- float tb = M_PI/4;
- float dt = M_PI/90;
- float x1 = PHI*ta + (1-PHI)*tb;
+ double ta = -M_PI/4;
+ double tb = M_PI/4;
+ double dt = M_PI/90;
+ float x1 = (float)(PHI*ta + (1-PHI)*tb);
float f1 = dollarDifference(points,templ,x1);
- float x2 = (1-PHI)*ta + PHI*tb;
+ float x2 = (float)((1-PHI)*ta + PHI*tb);
float f2 = dollarDifference(points,templ,x2);
- while(abs(ta-tb) > dt) {
+ while(fabs(ta-tb) > dt) {
if(f1 < f2) {
tb = x2;
x2 = x1;
f2 = f1;
- x1 = PHI*ta + (1-PHI)*tb;
+ x1 = (float)(PHI*ta + (1-PHI)*tb);
f1 = dollarDifference(points,templ,x1);
}
else {
ta = x1;
x1 = x2;
f1 = f2;
- x2 = (1-PHI)*ta + PHI*tb;
+ x2 = (float)((1-PHI)*ta + PHI*tb);
f2 = dollarDifference(points,templ,x2);
}
}
@@ -288,6 +295,14 @@
//DollarPath contains raw points, plus (possibly) the calculated length
int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
int i;
+ float interval;
+ float dist;
+ int numPoints = 0;
+ SDL_FloatPoint centroid;
+ float xmin,xmax,ymin,ymax;
+ float ang;
+ float w,h;
+
//Calculate length if it hasn't already been done
if(path.length <= 0) {
for(i=1;i<path.numPoints;i++) {
@@ -295,22 +310,20 @@
path.p[i-1].x;
float dy = path.p[i ].y -
path.p[i-1].y;
- path.length += sqrt(dx*dx+dy*dy);
+ path.length += (float)(sqrt(dx*dx+dy*dy));
}
}
//Resample
- float interval = path.length/(DOLLARNPOINTS - 1);
- float dist = interval;
+ interval = path.length/(DOLLARNPOINTS - 1);
+ dist = interval;
- int numPoints = 0;
- SDL_FloatPoint centroid;
centroid.x = 0;centroid.y = 0;
//printf("(%f,%f)\n",path.p[path.numPoints-1].x,path.p[path.numPoints-1].y);
for(i = 1;i < path.numPoints;i++) {
- float d = sqrt((path.p[i-1].x-path.p[i].x)*(path.p[i-1].x-path.p[i].x)+
- (path.p[i-1].y-path.p[i].y)*(path.p[i-1].y-path.p[i].y));
+ float d = (float)(sqrt((path.p[i-1].x-path.p[i].x)*(path.p[i-1].x-path.p[i].x)+
+ (path.p[i-1].y-path.p[i].y)*(path.p[i-1].y-path.p[i].y)));
//printf("d = %f dist = %f/%f\n",d,dist,interval);
while(dist + d > interval) {
points[numPoints].x = path.p[i-1].x +
@@ -338,22 +351,21 @@
//printf("Centroid (%f,%f)",centroid.x,centroid.y);
//Rotate Points so point 0 is left of centroid and solve for the bounding box
- float xmin,xmax,ymin,ymax;
xmin = centroid.x;
xmax = centroid.x;
ymin = centroid.y;
ymax = centroid.y;
- float ang = atan2(centroid.y - points[0].y,
- centroid.x - points[0].x);
+ ang = (float)(atan2(centroid.y - points[0].y,
+ centroid.x - points[0].x));
for(i = 0;i<numPoints;i++) {
float px = points[i].x;
float py = points[i].y;
- points[i].x = (px - centroid.x)*cos(ang) -
- (py - centroid.y)*sin(ang) + centroid.x;
- points[i].y = (px - centroid.x)*sin(ang) +
- (py - centroid.y)*cos(ang) + centroid.y;
+ points[i].x = (float)((px - centroid.x)*cos(ang) -
+ (py - centroid.y)*sin(ang) + centroid.x);
+ points[i].y = (float)((px - centroid.x)*sin(ang) +
+ (py - centroid.y)*cos(ang) + centroid.y);
if(points[i].x < xmin) xmin = points[i].x;
@@ -363,8 +375,8 @@
}
//Scale points to DOLLARSIZE, and translate to the origin
- float w = xmax-xmin;
- float h = ymax-ymin;
+ w = xmax-xmin;
+ h = ymax-ymin;
for(i=0;i<numPoints;i++) {
points[i].x = (points[i].x - centroid.x)*DOLLARSIZE/w;
@@ -380,17 +392,17 @@
//SDL_PrintPath(points);
int i;
- int bestDiff = 10000;
+ float bestDiff = 10000;
*bestTempl = -1;
for(i = 0;i < touch->numDollarTemplates;i++) {
- int diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
+ float diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
if(diff < bestDiff) {bestDiff = diff; *bestTempl = i;}
}
return bestDiff;
}
int SDL_GestureAddTouch(SDL_Touch* touch) {
- SDL_GestureTouch *gestureTouch = SDL_realloc(SDL_gestureTouch,
+ SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
(SDL_numGestureTouches + 1) *
sizeof(SDL_GestureTouch));
@@ -479,6 +491,18 @@
void SDL_GestureProcessEvent(SDL_Event* event)
{
+ float x,y;
+ SDL_FloatPoint path[DOLLARNPOINTS];
+ int index;
+ int i;
+ float pathDx, pathDy;
+ SDL_FloatPoint lastP;
+ SDL_FloatPoint lastCentroid;
+ float lDist;
+ float Dist;
+ float dtheta;
+ float dDist;
+
if(event->type == SDL_FINGERMOTION ||
event->type == SDL_FINGERDOWN ||
event->type == SDL_FINGERUP) {
@@ -492,8 +516,8 @@
// (int)inTouch->res.x,(int)inTouch->res.y);
- float x = ((float)event->tfinger.x)/(float)inTouch->res.x;
- float y = ((float)event->tfinger.y)/(float)inTouch->res.y;
+ x = ((float)event->tfinger.x)/(float)inTouch->res.x;
+ y = ((float)event->tfinger.y)/(float)inTouch->res.y;
//Finger Up
@@ -502,14 +526,11 @@
#ifdef ENABLE_DOLLAR
if(inTouch->recording) {
- inTouch->recording = SDL_FALSE;
- SDL_FloatPoint path[DOLLARNPOINTS];
+ inTouch->recording = SDL_FALSE;
dollarNormalize(inTouch->dollarPath,path);
//SDL_PrintPath(path);
- int index;
if(recordAll) {
index = SDL_AddDollarGesture(NULL,path);
- int i;
for(i = 0;i < SDL_numGestureTouches; i++)
SDL_gestureTouch[i].recording = SDL_FALSE;
}
@@ -554,18 +575,16 @@
if(path->numPoints < MAXPATHSIZE) {
path->p[path->numPoints].x = inTouch->centroid.x;
path->p[path->numPoints].y = inTouch->centroid.y;
- float pathDx =
+ pathDx =
(path->p[path->numPoints].x-path->p[path->numPoints-1].x);
- float pathDy =
+ pathDy =
(path->p[path->numPoints].y-path->p[path->numPoints-1].y);
- path->length += sqrt(pathDx*pathDx + pathDy*pathDy);
+ path->length += (float)sqrt(pathDx*pathDx + pathDy*pathDy);
path->numPoints++;
}
#endif
- SDL_FloatPoint lastP;
lastP.x = x - dx;
lastP.y = y - dy;
- SDL_FloatPoint lastCentroid;
lastCentroid = inTouch->centroid;
inTouch->centroid.x += dx/inTouch->numDownFingers;
@@ -577,12 +596,12 @@
//lv = inTouch->gestureLast[j].cv;
lv.x = lastP.x - lastCentroid.x;
lv.y = lastP.y - lastCentroid.y;
- float lDist = sqrt(lv.x*lv.x + lv.y*lv.y);
+ lDist = (float)sqrt(lv.x*lv.x + lv.y*lv.y);
//printf("lDist = %f\n",lDist);
v.x = x - inTouch->centroid.x;
v.y = y - inTouch->centroid.y;
//inTouch->gestureLast[j].cv = v;
- float Dist = sqrt(v.x*v.x+v.y*v.y);
+ Dist = (float)sqrt(v.x*v.x+v.y*v.y);
// cos(dTheta) = (v . lv)/(|v| * |lv|)
//Normalize Vectors to simplify angle calculation
@@ -590,9 +609,9 @@
lv.y/=lDist;
v.x/=Dist;
v.y/=Dist;
- float dtheta = atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
+ dtheta = (float)atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
- float dDist = (Dist - lDist);
+ dDist = (Dist - lDist);
if(lDist == 0) {dDist = 0;dtheta = 0;} //To avoid impossible values
//inTouch->gestureLast[j].dDist = dDist;
--- a/src/events/SDL_touch.c Sun Aug 22 17:19:10 2010 -0700
+++ b/src/events/SDL_touch.c Mon Aug 23 23:44:28 2010 -0700
@@ -313,6 +313,11 @@
float xin, float yin, float pressurein)
{
int posted;
+ Uint16 x;
+ Uint16 y;
+ Uint16 pressure;
+ SDL_Finger *finger;
+
SDL_Touch* touch = SDL_GetTouch(id);
if(!touch) {
@@ -321,11 +326,11 @@
//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);
+ x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres));
+ y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres));
+ pressure = (Uint16)((yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres));
- SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
+ finger = SDL_GetFinger(touch,fingerid);
if(down) {
if(finger == NULL) {
SDL_Finger nf;
@@ -393,15 +398,18 @@
int posted;
Sint16 xrel, yrel;
float x_max = 0, y_max = 0;
+ Uint16 x;
+ Uint16 y;
+ Uint16 pressure;
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);
+ x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres));
+ y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres));
+ pressure = (Uint16)((yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres));
if(touch->flush_motion) {
return 0;
}
@@ -544,9 +552,9 @@
}
int SDL_TouchNotFoundError(SDL_TouchID id) {
+ int i;
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;
for(i=0;i < SDL_num_touch;i++) {
printf("ERROR: %li\n",SDL_touchPads[i]->id);
}
--- a/src/video/win32/SDL_win32events.c Sun Aug 22 17:19:10 2010 -0700
+++ b/src/video/win32/SDL_win32events.c Mon Aug 23 23:44:28 2010 -0700
@@ -25,6 +25,10 @@
#define _WIN32_WINNT 0x601
#endif
+// disable deprecation of fopen()
+#define _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_DEPRECATE
+
#include "SDL_config.h"
#include "SDL_win32video.h"
@@ -33,8 +37,6 @@
#include "SDL_vkeys.h"
#include "../../events/SDL_events_c.h"
-
-
#define WMMSG_DEBUG
#ifdef WMMSG_DEBUG
#include <stdio.h>
--- a/src/video/win32/SDL_win32keyboard.c Sun Aug 22 17:19:10 2010 -0700
+++ b/src/video/win32/SDL_win32keyboard.c Mon Aug 23 23:44:28 2010 -0700
@@ -28,6 +28,7 @@
#include <imm.h>
#include <oleauto.h>
+#include <winver.h>
static void IME_Init(SDL_VideoData *videodata, HWND hwnd);
static void IME_Enable(SDL_VideoData *videodata, HWND hwnd);
@@ -246,7 +247,7 @@
videodata->ime_hwnd_main = hwnd;
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) {
videodata->ime_com_initialized = SDL_TRUE;
- CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, &videodata->ime_threadmgr);
+ CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr);
}
videodata->ime_initialized = SDL_TRUE;
videodata->ime_himm32 = LoadLibraryA("imm32.dll");
@@ -260,8 +261,10 @@
videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))GetProcAddress(videodata->ime_himm32, "ImmUnlockIMCC");
IME_SetWindow(videodata, hwnd);
+#ifdef _WIN32_WCE
videodata->ime_himc = ImmGetContext(hwnd);
ImmReleaseContext(hwnd, videodata->ime_himc);
+#endif
if (!videodata->ime_himc) {
videodata->ime_available = SDL_FALSE;
IME_Disable(videodata, hwnd);
@@ -285,8 +288,10 @@
IME_Disable(videodata, hwnd);
return;
}
- if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
+#ifdef _WIN32_WCE
+ if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
ImmAssociateContext(videodata->ime_hwnd_current, videodata->ime_himc);
+#endif
videodata->ime_enabled = SDL_TRUE;
IME_UpdateInputLocale(videodata);
@@ -300,8 +305,10 @@
return;
IME_ClearComposition(videodata);
+#ifdef _WIN32_WCE
if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
ImmAssociateContext(videodata->ime_hwnd_current, NULL);
+#endif
videodata->ime_enabled = SDL_FALSE;
UILess_DisableUIUpdates(videodata);
@@ -314,8 +321,10 @@
return;
UILess_ReleaseSinks(videodata);
+#ifdef _WIN32_WCE
if (videodata->ime_hwnd_main)
ImmAssociateContext(videodata->ime_hwnd_main, videodata->ime_himc);
+#endif
videodata->ime_hwnd_main = 0;
videodata->ime_himc = 0;
@@ -358,9 +367,11 @@
if (!id)
return;
+#ifdef _WIN32_WCE
himc = ImmGetContext(hwnd);
if (!himc)
return;
+#endif
if (videodata->GetReadingString) {
len = videodata->GetReadingString(himc, 0, 0, &err, &vertical, &maxuilen);
@@ -431,7 +442,9 @@
videodata->ImmUnlockIMCC(lpimc->hPrivate);
videodata->ImmUnlockIMC(himc);
}
+#ifdef _WIN32_WCE
ImmReleaseContext(hwnd, himc);
+#endif
IME_SendEditingEvent(videodata);
}
@@ -445,11 +458,13 @@
if (lang != PRIMLANG()) {
IME_ClearComposition(videodata);
}
+#ifdef _WIN32_WCE
hwndime = ImmGetDefaultIMEWnd(videodata->ime_hwnd_current);
if (hwndime) {
SendMessageA(hwndime, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0);
SendMessageA(hwndime, WM_IME_CONTROL, IMC_CLOSESTATUSWINDOW, 0);
}
+#endif
}
static DWORD
@@ -487,11 +502,13 @@
dwRet[0] = dwRet[1] = 0;
return dwRet[uIndex];
}
+#ifdef _WIN32_WCE
if (ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1) <= 0) {
dwRet[0] = dwRet[1] = 0;
return dwRet[uIndex];
}
- if (!videodata->GetReadingString) {
+#endif
+ if (!videodata->GetReadingString) {
#define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
if (CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME1, -1) != 2
&& CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME2, -1) != 2
@@ -553,8 +570,10 @@
return;
hkl = videodata->ime_hkl;
- if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0)
+#ifdef _WIN32_WCE
+ if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0)
return;
+#endif
hime = LoadLibraryA(ime_file);
if (!hime)
@@ -565,13 +584,15 @@
videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL))
GetProcAddress(hime, "ShowReadingWindow");
+#ifdef _WIN32_WCE
if (videodata->ShowReadingWindow) {
HIMC himc = ImmGetContext(videodata->ime_hwnd_current);
if (himc) {
- videodata->ShowReadingWindow(himc, FALSE);
+ videodata->ShowReadingWindow(himc, FALSE);
ImmReleaseContext(videodata->ime_hwnd_current, himc);
}
}
+#endif
}
static void
@@ -605,6 +626,7 @@
if (!videodata->ime_initialized)
return;
+#ifdef _WIN32_WCE
himc = ImmGetContext(videodata->ime_hwnd_current);
if (!himc)
return;
@@ -615,6 +637,7 @@
ImmNotifyIME(himc, NI_CLOSECANDIDATE, 0, 0);
ImmReleaseContext(videodata->ime_hwnd_current, himc);
+#endif
SDL_SendEditingText("", 0, 0);
}
@@ -697,6 +720,7 @@
break;
case WM_IME_COMPOSITION:
trap = SDL_TRUE;
+#ifdef _WIN32_WCE
himc = ImmGetContext(hwnd);
if (*lParam & GCS_RESULTSTR) {
IME_GetCompositionString(videodata, himc, GCS_RESULTSTR);
@@ -710,6 +734,7 @@
IME_SendEditingEvent(videodata);
}
ImmReleaseContext(hwnd, himc);
+#endif
break;
case WM_IME_ENDCOMPOSITION:
videodata->ime_composition[0] = 0;