Use SDL_Start/StopTextInput() also with SDL2

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")
This commit is contained in:
Daniel Gibson 2025-01-17 02:05:50 +01:00
parent c23d819f5e
commit e3795a36e0

View file

@ -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