[Scummvm-git-logs] scummvm master -> d03f4726539dc85fb3c669512b1830841fbf8c83

sev- noreply at scummvm.org
Fri Aug 7 22:02:11 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
d03f472653 BACKENDS: SDL: Preserve SDL text input for active ImGui text fields


Commit: d03f4726539dc85fb3c669512b1830841fbf8c83
    https://github.com/scummvm/scummvm/commit/d03f4726539dc85fb3c669512b1830841fbf8c83
Author: ramyak-sharma (ramyaksharma1 at gmail.com)
Date: 2026-08-08T00:02:07+02:00

Commit Message:
BACKENDS: SDL: Preserve SDL text input for active ImGui text fields

Do not consume SDL_TEXTINPUT events while an ImGui text field has
keyboard focus, allowing text entry to work correctly.

Changed paths:
    backends/events/sdl/sdl2-events.cpp
    backends/events/sdl/sdl3-events.cpp


diff --git a/backends/events/sdl/sdl2-events.cpp b/backends/events/sdl/sdl2-events.cpp
index 8b23ee39112..6cddd032792 100644
--- a/backends/events/sdl/sdl2-events.cpp
+++ b/backends/events/sdl/sdl2-events.cpp
@@ -1081,6 +1081,15 @@ SDL_Keycode SdlEventSource::obtainKeycode(const SDL_Keysym keySym) {
 uint32 SdlEventSource::obtainUnicode(const SDL_KeyboardEvent &key) {
 	SDL_Event events[2];
 
+#if defined(USE_IMGUI)
+	// When ImGui is capturing text input, leave the SDL_TEXTINPUT event in the
+	// queue so its InputText widgets receive the character. We normally consume
+	// it here to fold the ASCII into ScummVM's own key event, but ScummVM's GUI
+	// is not the input target while an ImGui text field is active.
+	if (ImGui_ImplSDL2_Ready() && ImGui::GetIO().WantTextInput)
+		return 0;
+#endif
+
 	// Update the event queue here to give SDL a chance to insert TEXTINPUT
 	// events for KEYDOWN events. Otherwise we have a high chance that on
 	// Windows the TEXTINPUT event is not in the event queue at this point.
diff --git a/backends/events/sdl/sdl3-events.cpp b/backends/events/sdl/sdl3-events.cpp
index 2060d41fbb3..cb344b23027 100644
--- a/backends/events/sdl/sdl3-events.cpp
+++ b/backends/events/sdl/sdl3-events.cpp
@@ -1040,6 +1040,15 @@ bool SdlEventSource::isJoystickConnected() const {
 uint32 SdlEventSource::obtainUnicode(const SDL_KeyboardEvent &key) {
 	SDL_Event events[2];
 
+#if defined(USE_IMGUI)
+	// When ImGui is capturing text input, leave the SDL_EVENT_TEXT_INPUT event
+	// in the queue so its InputText widgets receive the character. We normally
+	// consume it here to fold the ASCII into ScummVM's own key event, but
+	// ScummVM's GUI is not the input target while an ImGui text field is active.
+	if (ImGui_ImplSDL3_Ready() && ImGui::GetIO().WantTextInput)
+		return 0;
+#endif
+
 	// Update the event queue here to give SDL a chance to insert TEXTINPUT
 	// events for KEYDOWN events. Otherwise we have a high chance that on
 	// Windows the TEXTINPUT event is not in the event queue at this point.




More information about the Scummvm-git-logs mailing list