Skip to content

Commit

Permalink
Use SDL_Start/StopTextInput() also with SDL2
Browse files Browse the repository at this point in the history
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")
  • Loading branch information
DanielGibson committed Jan 17, 2025
1 parent c23d819 commit e3795a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neo/sys/glimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e3795a3

Please sign in to comment.