Changed Start/StopTextInput back to not take any parameters.
authordewyatt
Mon, 12 Jul 2010 14:17:43 -0400
changeset 475311b0a6a3eb4d
parent 4752 dc7bdcf06367
child 4754 2072fed2f583
Changed Start/StopTextInput back to not take any parameters.
We call SDL_GetKeyboardFocus internally now.
include/SDL_keyboard.h
src/SDL_compat.c
src/events/SDL_keyboard.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/win32/SDL_win32keyboard.c
src/video/win32/SDL_win32keyboard.h
     1.1 --- a/include/SDL_keyboard.h	Mon Jul 12 11:33:27 2010 -0400
     1.2 +++ b/include/SDL_keyboard.h	Mon Jul 12 14:17:43 2010 -0400
     1.3 @@ -140,14 +140,14 @@
     1.4   *  \sa SDL_StopTextInput()
     1.5   *  \sa SDL_SetTextInputRect()
     1.6   */
     1.7 -extern DECLSPEC void SDLCALL SDL_StartTextInput(SDL_Window *window);
     1.8 +extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
     1.9  
    1.10  /**
    1.11   *  \brief Stop receiving any text input events.
    1.12   *  
    1.13   *  \sa SDL_StartTextInput()
    1.14   */
    1.15 -extern DECLSPEC void SDLCALL SDL_StopTextInput(SDL_Window *window);
    1.16 +extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
    1.17  
    1.18  /**
    1.19   *  \brief Set the rectangle used to type Unicode text inputs.
     2.1 --- a/src/SDL_compat.c	Mon Jul 12 11:33:27 2010 -0400
     2.2 +++ b/src/SDL_compat.c	Mon Jul 12 14:17:43 2010 -0400
     2.3 @@ -1740,11 +1740,11 @@
     2.4      switch (enable) {
     2.5      case 1:
     2.6          SDL_enabled_UNICODE = 1;
     2.7 -        SDL_StartTextInput(SDL_VideoWindow);
     2.8 +        SDL_StartTextInput();
     2.9          break;
    2.10      case 0:
    2.11          SDL_enabled_UNICODE = 0;
    2.12 -        SDL_StopTextInput(SDL_VideoWindow);
    2.13 +        SDL_StopTextInput();
    2.14          break;
    2.15      }
    2.16      return previous;
     3.1 --- a/src/events/SDL_keyboard.c	Mon Jul 12 11:33:27 2010 -0400
     3.2 +++ b/src/events/SDL_keyboard.c	Mon Jul 12 14:17:43 2010 -0400
     3.3 @@ -617,7 +617,7 @@
     3.4                              0, 0);
     3.5  
     3.6          if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
     3.7 -            SDL_StartTextInput(window);
     3.8 +            SDL_StartTextInput();
     3.9          }
    3.10      }
    3.11  }
     4.1 --- a/src/video/SDL_sysvideo.h	Mon Jul 12 11:33:27 2010 -0400
     4.2 +++ b/src/video/SDL_sysvideo.h	Mon Jul 12 14:17:43 2010 -0400
     4.3 @@ -299,8 +299,8 @@
     4.4      void (*SuspendScreenSaver) (_THIS);
     4.5  
     4.6      /* Text input */
     4.7 -    void (*StartTextInput) (_THIS, SDL_Window *window);
     4.8 -    void (*StopTextInput) (_THIS, SDL_Window *window);
     4.9 +    void (*StartTextInput) (_THIS);
    4.10 +    void (*StopTextInput) (_THIS);
    4.11      void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
    4.12  
    4.13      /* * * */
     5.1 --- a/src/video/SDL_video.c	Mon Jul 12 11:33:27 2010 -0400
     5.2 +++ b/src/video/SDL_video.c	Mon Jul 12 14:17:43 2010 -0400
     5.3 @@ -3385,20 +3385,20 @@
     5.4  }
     5.5  
     5.6  void
     5.7 -SDL_StartTextInput(SDL_Window *window)
     5.8 +SDL_StartTextInput(void)
     5.9  {
    5.10      if (_this && _this->StartTextInput) {
    5.11 -        _this->StartTextInput(_this, window);
    5.12 +        _this->StartTextInput(_this);
    5.13      }
    5.14      SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
    5.15      SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE);
    5.16  }
    5.17  
    5.18  void
    5.19 -SDL_StopTextInput(SDL_Window *window)
    5.20 +SDL_StopTextInput(void)
    5.21  {
    5.22      if (_this && _this->StopTextInput) {
    5.23 -        _this->StopTextInput(_this, window);
    5.24 +        _this->StopTextInput(_this);
    5.25      }
    5.26      SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
    5.27      SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
     6.1 --- a/src/video/win32/SDL_win32keyboard.c	Mon Jul 12 11:33:27 2010 -0400
     6.2 +++ b/src/video/win32/SDL_win32keyboard.c	Mon Jul 12 14:17:43 2010 -0400
     6.3 @@ -141,21 +141,29 @@
     6.4  }
     6.5  
     6.6  void
     6.7 -WIN_StartTextInput(_THIS, SDL_Window *window)
     6.8 +WIN_StartTextInput(_THIS)
     6.9  {
    6.10 -    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
    6.11 -    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
    6.12 -    IME_Init(videodata, hwnd);
    6.13 -    IME_Enable(videodata, hwnd);
    6.14 +    SDL_Window *window = SDL_GetKeyboardFocus();
    6.15 +    if (window)
    6.16 +    {
    6.17 +        HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
    6.18 +        SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
    6.19 +        IME_Init(videodata, hwnd);
    6.20 +        IME_Enable(videodata, hwnd);
    6.21 +    }
    6.22  }
    6.23  
    6.24  void
    6.25 -WIN_StopTextInput(_THIS, SDL_Window *window)
    6.26 +WIN_StopTextInput(_THIS)
    6.27  {
    6.28 -    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
    6.29 -    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
    6.30 -    IME_Init(videodata, hwnd);
    6.31 -    IME_Disable(videodata, hwnd);
    6.32 +    SDL_Window *window = SDL_GetKeyboardFocus();
    6.33 +    if (window)
    6.34 +    {
    6.35 +        HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
    6.36 +        SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
    6.37 +        IME_Init(videodata, hwnd);
    6.38 +        IME_Disable(videodata, hwnd);
    6.39 +    }
    6.40  }
    6.41  
    6.42  void
     7.1 --- a/src/video/win32/SDL_win32keyboard.h	Mon Jul 12 11:33:27 2010 -0400
     7.2 +++ b/src/video/win32/SDL_win32keyboard.h	Mon Jul 12 14:17:43 2010 -0400
     7.3 @@ -31,8 +31,8 @@
     7.4  extern void WIN_UpdateKeymap(void);
     7.5  extern void WIN_QuitKeyboard(_THIS);
     7.6  
     7.7 -extern void WIN_StartTextInput(_THIS, SDL_Window *window);
     7.8 -extern void WIN_StopTextInput(_THIS, SDL_Window *window);
     7.9 +extern void WIN_StartTextInput(_THIS);
    7.10 +extern void WIN_StopTextInput(_THIS);
    7.11  extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect);
    7.12  
    7.13  extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata);