Fixed bug 3682 - Toggle text input in checkkeys when the mouse is clicked
authorSam Lantinga <slouken@libsdl.org>
Fri, 11 Aug 2017 10:32:47 -0700
changeset 1122054ea94875b88
parent 11219 f94279990934
child 11221 4753f2320927
Fixed bug 3682 - Toggle text input in checkkeys when the mouse is clicked

Eric Wasylishen

Small change to checkkeys so you can toggle text input mode with a mouse click.
This is needed for testing how dead keys react to toggling mouse input, i.e. these bugs:
test/checkkeys.c
     1.1 --- a/test/checkkeys.c	Fri Aug 11 10:21:19 2017 -0700
     1.2 +++ b/test/checkkeys.c	Fri Aug 11 10:32:47 2017 -0700
     1.3 @@ -168,7 +168,19 @@
     1.4              PrintText("INPUT", event.text.text);
     1.5              break;
     1.6          case SDL_MOUSEBUTTONDOWN:
     1.7 -            /* Any button press quits the app... */
     1.8 +            /* Left button quits the app, other buttons toggles text input */
     1.9 +            if (event.button.button == SDL_BUTTON_LEFT) {
    1.10 +                done = 1;
    1.11 +            } else {
    1.12 +                if (SDL_IsTextInputActive()) {
    1.13 +                    SDL_Log("Stopping text input\n");
    1.14 +                    SDL_StopTextInput();
    1.15 +                } else {
    1.16 +                    SDL_Log("Starting text input\n");
    1.17 +                    SDL_StartTextInput();
    1.18 +                }
    1.19 +            }
    1.20 +            break;
    1.21          case SDL_QUIT:
    1.22              done = 1;
    1.23              break;