Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Changed Start/StopTextInput back to not take any parameters.
Browse files Browse the repository at this point in the history
We call SDL_GetKeyboardFocus internally now.
  • Loading branch information
dewyatt committed Jul 12, 2010
1 parent 53fe014 commit 50e06e6
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 23 deletions.
4 changes: 2 additions & 2 deletions include/SDL_keyboard.h
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/SDL_compat.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/events/SDL_keyboard.c
Expand Up @@ -617,7 +617,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
0, 0);

if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_StartTextInput(window);
SDL_StartTextInput();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/video/SDL_sysvideo.h
Expand Up @@ -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);

/* * * */
Expand Down
8 changes: 4 additions & 4 deletions src/video/SDL_video.c
Expand Up @@ -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);
Expand Down
28 changes: 18 additions & 10 deletions src/video/win32/SDL_win32keyboard.c
Expand Up @@ -141,21 +141,29 @@ WIN_QuitKeyboard(_THIS)
}

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
Expand Down
4 changes: 2 additions & 2 deletions src/video/win32/SDL_win32keyboard.h
Expand Up @@ -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);
Expand Down

0 comments on commit 50e06e6

Please sign in to comment.