From e3795a36e0624d2e97b64deb0b1d18ecb66db405 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Fri, 17 Jan 2025 02:05:50 +0100 Subject: [PATCH] Use SDL_Start/StopTextInput() also with SDL2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on whether handleMouseGrab() in events.cpp sets GRAB_ENABLETEXTINPUT or not. Should prevent the issue that on macOS pressing a button for longer while playing (as one does, e.g. to run forward) opens a popup menu with alternative characters (like "è", "é", "ê", etc for "e") --- neo/sys/glimp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neo/sys/glimp.cpp b/neo/sys/glimp.cpp index e554d7a1..57b615fd 100644 --- a/neo/sys/glimp.cpp +++ b/neo/sys/glimp.cpp @@ -1191,6 +1191,11 @@ void GLimp_GrabInput(int flags) { SDL_ShowCursor( (flags & GRAB_HIDECURSOR) ? SDL_DISABLE : SDL_ENABLE ); SDL_SetRelativeMouseMode( (flags & GRAB_RELATIVEMOUSE) ? SDL_TRUE : SDL_FALSE ); SDL_SetWindowGrab( window, (flags & GRAB_GRABMOUSE) ? SDL_TRUE : SDL_FALSE ); + if (flags & GRAB_ENABLETEXTINPUT) { + SDL_StartTextInput(); + } else { + SDL_StopTextInput(); + } #else SDL_ShowCursor( (flags & GRAB_HIDECURSOR) ? SDL_DISABLE : SDL_ENABLE ); // ignore GRAB_GRABMOUSE, SDL1.2 doesn't support grabbing without relative mode