From cbd5b5b32e14bf84ea55f5b47ba60a7045480a44 Mon Sep 17 00:00:00 2001 From: dewyatt Date: Thu, 8 Jul 2010 01:35:47 -0400 Subject: [PATCH] Changed StartTextInput to take an SDL_Window parameter. --- include/SDL_keyboard.h | 2 +- src/SDL_compat.c | 2 +- src/events/SDL_keyboard.c | 2 +- src/video/SDL_sysvideo.h | 2 +- src/video/SDL_video.c | 4 ++-- src/video/win32/SDL_win32keyboard.c | 3 +-- src/video/win32/SDL_win32keyboard.h | 2 +- src/video/win32/SDL_win32video.c | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/SDL_keyboard.h b/include/SDL_keyboard.h index 4482ac028..fca34506f 100644 --- a/include/SDL_keyboard.h +++ b/include/SDL_keyboard.h @@ -140,7 +140,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key); * \sa SDL_StopTextInput() * \sa SDL_SetTextInputRect() */ -extern DECLSPEC void SDLCALL SDL_StartTextInput(void); +extern DECLSPEC void SDLCALL SDL_StartTextInput(SDL_Window *window); /** * \brief Stop receiving any text input events. diff --git a/src/SDL_compat.c b/src/SDL_compat.c index bb8e46ba8..51b9b5ceb 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -1740,7 +1740,7 @@ SDL_EnableUNICODE(int enable) switch (enable) { case 1: SDL_enabled_UNICODE = 1; - SDL_StartTextInput(); + SDL_StartTextInput(SDL_VideoWindow); break; case 0: SDL_enabled_UNICODE = 0; diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index f25bc6af8..5de1116e3 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -617,7 +617,7 @@ SDL_SetKeyboardFocus(SDL_Window * window) 0, 0); if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { - SDL_StartTextInput(); + SDL_StartTextInput(window); } } } diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 0a82717ec..69ecb440d 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -299,7 +299,7 @@ struct SDL_VideoDevice void (*SuspendScreenSaver) (_THIS); /* Text input */ - void (*StartTextInput) (_THIS); + void (*StartTextInput) (_THIS, SDL_Window *window); void (*StopTextInput) (_THIS); void (*SetTextInputRect) (_THIS, SDL_Rect *rect); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index db8b5d3cb..744defea4 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3385,10 +3385,10 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) } void -SDL_StartTextInput(void) +SDL_StartTextInput(SDL_Window *window) { if (_this && _this->StartTextInput) { - _this->StartTextInput(_this); + _this->StartTextInput(_this, window); } SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); diff --git a/src/video/win32/SDL_win32keyboard.c b/src/video/win32/SDL_win32keyboard.c index cbb760d0d..4ee297be7 100644 --- a/src/video/win32/SDL_win32keyboard.c +++ b/src/video/win32/SDL_win32keyboard.c @@ -123,9 +123,8 @@ WIN_QuitKeyboard(_THIS) } void -WIN_StartTextInput(_THIS) +WIN_StartTextInput(_THIS, SDL_Window *window) { - SDL_Window *window = SDL_GetKeyboardFocus(); HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; } diff --git a/src/video/win32/SDL_win32keyboard.h b/src/video/win32/SDL_win32keyboard.h index 76894931e..d9e54b3bd 100644 --- a/src/video/win32/SDL_win32keyboard.h +++ b/src/video/win32/SDL_win32keyboard.h @@ -31,7 +31,7 @@ extern void WIN_InitKeyboard(_THIS); extern void WIN_UpdateKeymap(void); extern void WIN_QuitKeyboard(_THIS); -extern void WIN_StartTextInput(_THIS); +extern void WIN_StartTextInput(_THIS, SDL_Window *window); extern void WIN_StopTextInput(_THIS); extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); diff --git a/src/video/win32/SDL_win32video.c b/src/video/win32/SDL_win32video.c index 40b5a3b72..b169bd959 100644 --- a/src/video/win32/SDL_win32video.c +++ b/src/video/win32/SDL_win32video.c @@ -163,7 +163,7 @@ WIN_CreateDevice(int devindex) device->GL_DeleteContext = WIN_GL_DeleteContext; #endif device->StartTextInput = WIN_StartTextInput; - device->StopTextInput = WIN_StartTextInput; + device->StopTextInput = WIN_StopTextInput; device->SetTextInputRect = WIN_SetTextInputRect; device->free = WIN_DeleteDevice;