diff src/video/win32/SDL_win32keyboard.c @ 4880:27c458e4ae31

Update VS2010 project to add new files; update new files so code builds on Win32/Win64
author Andreas Schiffler <aschiffler@ferzkopp.net>
date Mon, 23 Aug 2010 23:44:28 -0700
parents 518d1679d2d0
children
line wrap: on
line diff
--- 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;