From 222bacd86c260255feee576ad6b8e72173cc5fa9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 Aug 2017 10:32:47 -0700 Subject: [PATCH] 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/checkkeys.c b/test/checkkeys.c index 80aeef869c5e1..066c786d4392d 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -168,7 +168,19 @@ loop() 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;