Commit 7e8c7910 authored by dewyatt's avatar dewyatt

Changed Start/StopTextInput back to not take any parameters.

We call SDL_GetKeyboardFocus internally now.
parent 3d5a6d85
...@@ -140,14 +140,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key); ...@@ -140,14 +140,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
* \sa SDL_StopTextInput() * \sa SDL_StopTextInput()
* \sa SDL_SetTextInputRect() * \sa SDL_SetTextInputRect()
*/ */
extern DECLSPEC void SDLCALL SDL_StartTextInput(SDL_Window *window); extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
/** /**
* \brief Stop receiving any text input events. * \brief Stop receiving any text input events.
* *
* \sa SDL_StartTextInput() * \sa SDL_StartTextInput()
*/ */
extern DECLSPEC void SDLCALL SDL_StopTextInput(SDL_Window *window); extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
/** /**
* \brief Set the rectangle used to type Unicode text inputs. * \brief Set the rectangle used to type Unicode text inputs.
......
...@@ -1740,11 +1740,11 @@ SDL_EnableUNICODE(int enable) ...@@ -1740,11 +1740,11 @@ SDL_EnableUNICODE(int enable)
switch (enable) { switch (enable) {
case 1: case 1:
SDL_enabled_UNICODE = 1; SDL_enabled_UNICODE = 1;
SDL_StartTextInput(SDL_VideoWindow); SDL_StartTextInput();
break; break;
case 0: case 0:
SDL_enabled_UNICODE = 0; SDL_enabled_UNICODE = 0;
SDL_StopTextInput(SDL_VideoWindow); SDL_StopTextInput();
break; break;
} }
return previous; return previous;
......
...@@ -617,7 +617,7 @@ SDL_SetKeyboardFocus(SDL_Window * window) ...@@ -617,7 +617,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
0, 0); 0, 0);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_StartTextInput(window); SDL_StartTextInput();
} }
} }
} }
......
...@@ -299,8 +299,8 @@ struct SDL_VideoDevice ...@@ -299,8 +299,8 @@ struct SDL_VideoDevice
void (*SuspendScreenSaver) (_THIS); void (*SuspendScreenSaver) (_THIS);
/* Text input */ /* Text input */
void (*StartTextInput) (_THIS, SDL_Window *window); void (*StartTextInput) (_THIS);
void (*StopTextInput) (_THIS, SDL_Window *window); void (*StopTextInput) (_THIS);
void (*SetTextInputRect) (_THIS, SDL_Rect *rect); void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
/* * * */ /* * * */
......
...@@ -3385,20 +3385,20 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) ...@@ -3385,20 +3385,20 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
} }
void void
SDL_StartTextInput(SDL_Window *window) SDL_StartTextInput(void)
{ {
if (_this && _this->StartTextInput) { if (_this && _this->StartTextInput) {
_this->StartTextInput(_this, window); _this->StartTextInput(_this);
} }
SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE);
} }
void void
SDL_StopTextInput(SDL_Window *window) SDL_StopTextInput(void)
{ {
if (_this && _this->StopTextInput) { if (_this && _this->StopTextInput) {
_this->StopTextInput(_this, window); _this->StopTextInput(_this);
} }
SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
......
...@@ -141,21 +141,29 @@ WIN_QuitKeyboard(_THIS) ...@@ -141,21 +141,29 @@ WIN_QuitKeyboard(_THIS)
} }
void void
WIN_StartTextInput(_THIS, SDL_Window *window) WIN_StartTextInput(_THIS)
{ {
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; SDL_Window *window = SDL_GetKeyboardFocus();
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; if (window)
IME_Init(videodata, hwnd); {
IME_Enable(videodata, hwnd); HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
IME_Init(videodata, hwnd);
IME_Enable(videodata, hwnd);
}
} }
void void
WIN_StopTextInput(_THIS, SDL_Window *window) WIN_StopTextInput(_THIS)
{ {
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; SDL_Window *window = SDL_GetKeyboardFocus();
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; if (window)
IME_Init(videodata, hwnd); {
IME_Disable(videodata, hwnd); HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
IME_Init(videodata, hwnd);
IME_Disable(videodata, hwnd);
}
} }
void void
......
...@@ -31,8 +31,8 @@ extern void WIN_InitKeyboard(_THIS); ...@@ -31,8 +31,8 @@ extern void WIN_InitKeyboard(_THIS);
extern void WIN_UpdateKeymap(void); extern void WIN_UpdateKeymap(void);
extern void WIN_QuitKeyboard(_THIS); extern void WIN_QuitKeyboard(_THIS);
extern void WIN_StartTextInput(_THIS, SDL_Window *window); extern void WIN_StartTextInput(_THIS);
extern void WIN_StopTextInput(_THIS, SDL_Window *window); extern void WIN_StopTextInput(_THIS);
extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect);
extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata); extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment