Changed Start/StopTextInput back to not take any parameters.

We call SDL_GetKeyboardFocus internally now.
This commit is contained in:
dewyatt 2010-07-12 14:17:43 -04:00
parent 3d5a6d8597
commit 7e8c791089
7 changed files with 31 additions and 23 deletions

View file

@ -140,14 +140,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
* \sa SDL_StopTextInput()
* \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.
*
* \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.

View file

@ -1740,11 +1740,11 @@ SDL_EnableUNICODE(int enable)
switch (enable) {
case 1:
SDL_enabled_UNICODE = 1;
SDL_StartTextInput(SDL_VideoWindow);
SDL_StartTextInput();
break;
case 0:
SDL_enabled_UNICODE = 0;
SDL_StopTextInput(SDL_VideoWindow);
SDL_StopTextInput();
break;
}
return previous;

View file

@ -617,7 +617,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
0, 0);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_StartTextInput(window);
SDL_StartTextInput();
}
}
}

View file

@ -299,8 +299,8 @@ struct SDL_VideoDevice
void (*SuspendScreenSaver) (_THIS);
/* Text input */
void (*StartTextInput) (_THIS, SDL_Window *window);
void (*StopTextInput) (_THIS, SDL_Window *window);
void (*StartTextInput) (_THIS);
void (*StopTextInput) (_THIS);
void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
/* * * */

View file

@ -3385,20 +3385,20 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
}
void
SDL_StartTextInput(SDL_Window *window)
SDL_StartTextInput(void)
{
if (_this && _this->StartTextInput) {
_this->StartTextInput(_this, window);
_this->StartTextInput(_this);
}
SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE);
}
void
SDL_StopTextInput(SDL_Window *window)
SDL_StopTextInput(void)
{
if (_this && _this->StopTextInput) {
_this->StopTextInput(_this, window);
_this->StopTextInput(_this);
}
SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);

View file

@ -141,21 +141,29 @@ WIN_QuitKeyboard(_THIS)
}
void
WIN_StartTextInput(_THIS, SDL_Window *window)
WIN_StartTextInput(_THIS)
{
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)
{
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

View file

@ -31,8 +31,8 @@ extern void WIN_InitKeyboard(_THIS);
extern void WIN_UpdateKeymap(void);
extern void WIN_QuitKeyboard(_THIS);
extern void WIN_StartTextInput(_THIS, SDL_Window *window);
extern void WIN_StopTextInput(_THIS, SDL_Window *window);
extern void WIN_StartTextInput(_THIS);
extern void WIN_StopTextInput(_THIS);
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);