We can't check for the screen keyboard in the event code because the video system isn't fully initialized yet.
authorSam Lantinga <slouken@libsdl.org>
Fri, 09 Nov 2012 02:18:27 -0800
changeset 6670d4883f657288
parent 6669 c08febc180b9
child 6671 394e25751ef5
We can't check for the screen keyboard in the event code because the video system isn't fully initialized yet.
src/events/SDL_events.c
src/video/SDL_video.c
     1.1 --- a/src/events/SDL_events.c	Thu Nov 08 21:53:57 2012 -0800
     1.2 +++ b/src/events/SDL_events.c	Fri Nov 09 02:18:27 2012 -0800
     1.3 @@ -125,14 +125,10 @@
     1.4  
     1.5      /* No filter to start with, process most event types */
     1.6      SDL_EventOK = NULL;
     1.7 +    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
     1.8 +    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
     1.9      SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
    1.10  
    1.11 -    /* If text input shows UI onscreen we want to start with it disabled */
    1.12 -    if (SDL_HasScreenKeyboardSupport()) {
    1.13 -        SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
    1.14 -        SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
    1.15 -    }
    1.16 -
    1.17      /* Create the lock and set ourselves active */
    1.18  #if !SDL_THREADS_DISABLED
    1.19      if (!SDL_EventQ.lock) {
     2.1 --- a/src/video/SDL_video.c	Thu Nov 08 21:53:57 2012 -0800
     2.2 +++ b/src/video/SDL_video.c	Fri Nov 09 02:18:27 2012 -0800
     2.3 @@ -522,6 +522,17 @@
     2.4          _this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture;
     2.5      }
     2.6  
     2.7 +    /* If we don't use a screen keyboard, turn on text input by default,
     2.8 +       otherwise programs that expect to get text events without enabling
     2.9 +       UNICODE input won't get any events.
    2.10 +
    2.11 +       Actually, come to think of it, you needed to call SDL_EnableUNICODE(1)
    2.12 +       in SDL 1.2 before you got text input events.  Hmm...
    2.13 +     */
    2.14 +    if (!SDL_HasScreenKeyboardSupport()) {
    2.15 +        SDL_StartTextInput();
    2.16 +    }
    2.17 +
    2.18      /* We're ready to go! */
    2.19      return 0;
    2.20  }
    2.21 @@ -2831,7 +2842,12 @@
    2.22      if (_this && _this->SDL_HasScreenKeyboardSupport) {
    2.23          return _this->SDL_HasScreenKeyboardSupport(_this);
    2.24      }
    2.25 +/* FIXME: The event system queries this before we initialize our video driver */
    2.26 +#if __IPHONEOS__ || __ANDROID__
    2.27 +    return SDL_TRUE;
    2.28 +#else
    2.29      return SDL_FALSE;
    2.30 +#endif
    2.31  }
    2.32  
    2.33  SDL_bool