diff src/video/win32/SDL_win32keyboard.c @ 4753:11b0a6a3eb4d

Changed Start/StopTextInput back to not take any parameters. We call SDL_GetKeyboardFocus internally now.
author dewyatt
date Mon, 12 Jul 2010 14:17:43 -0400
parents dc7bdcf06367
children 863ba7d1f029
line wrap: on
line diff
--- a/src/video/win32/SDL_win32keyboard.c	Mon Jul 12 11:33:27 2010 -0400
+++ b/src/video/win32/SDL_win32keyboard.c	Mon Jul 12 14:17:43 2010 -0400
@@ -141,21 +141,29 @@
 }
 
 void
-WIN_StartTextInput(_THIS, SDL_Window *window)
+WIN_StartTextInput(_THIS)
 {
-    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
-    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
-    IME_Init(videodata, hwnd);
-    IME_Enable(videodata, hwnd);
+    SDL_Window *window = SDL_GetKeyboardFocus();
+    if (window)
+    {
+        HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+        SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+        IME_Init(videodata, hwnd);
+        IME_Enable(videodata, hwnd);
+    }
 }
 
 void
-WIN_StopTextInput(_THIS, SDL_Window *window)
+WIN_StopTextInput(_THIS)
 {
-    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
-    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
-    IME_Init(videodata, hwnd);
-    IME_Disable(videodata, hwnd);
+    SDL_Window *window = SDL_GetKeyboardFocus();
+    if (window)
+    {
+        HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+        SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+        IME_Init(videodata, hwnd);
+        IME_Disable(videodata, hwnd);
+    }
 }
 
 void