[Commits] SDL: Fixed bug 3682 - Toggle text input in checkkeys when the mo...

libsdl.org revision control commits-owner at libsdl.org
Fri Aug 11 10:32:50 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/54ea94875b88
changeset: 11220:54ea94875b88
user:      Sam Lantinga <slouken at libsdl.org>
date:      Fri Aug 11 10:32:47 2017 -0700
description:
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:

diffstat:

 test/checkkeys.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r f94279990934 -r 54ea94875b88 test/checkkeys.c
--- a/test/checkkeys.c	Fri Aug 11 10:21:19 2017 -0700
+++ b/test/checkkeys.c	Fri Aug 11 10:32:47 2017 -0700
@@ -168,7 +168,19 @@
             PrintText("INPUT", event.text.text);
             break;
         case SDL_MOUSEBUTTONDOWN:
-            /* Any button press quits the app... */
+            /* Left button quits the app, other buttons toggles text input */
+            if (event.button.button == SDL_BUTTON_LEFT) {
+                done = 1;
+            } else {
+                if (SDL_IsTextInputActive()) {
+                    SDL_Log("Stopping text input\n");
+                    SDL_StopTextInput();
+                } else {
+                    SDL_Log("Starting text input\n");
+                    SDL_StartTextInput();
+                }
+            }
+            break;
         case SDL_QUIT:
             done = 1;
             break;


More information about the commits mailing list