Skip to content

Commit fab96a6

Browse files
Green-Skyocornut
authored andcommitted
Backends: SDL3: Re-enable calling SDL_StartTextInput()/SDL_StopTextInput(). (#7452, #6306, #6071, #1953)
Amend: a7703fe
1 parent dad1689 commit fab96a6

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

backends/imgui_impl_sdl3.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
1111
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
1212
// Missing features:
13-
// [x] Platform: Basic IME support. Position somehow broken in SDL3 + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
13+
// [ ] Platform: IME SUPPORT IS BROKEN IN SDL3 BECAUSE INPUTS GETS SENT TO BOTH APP AND IME + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
1414

1515
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
1616
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
@@ -22,6 +22,7 @@
2222

2323
// CHANGELOG
2424
// (minor and older changes stripped away, please see git history for details)
25+
// 2024-04-15: Inputs: Re-enable calling SDL_StartTextInput()/SDL_StopTextInput() as SDL3 no longer enables it by default and should play nicer with IME.
2526
// 2024-02-13: Inputs: Fixed gamepad support. Handle gamepad disconnection. Added ImGui_ImplSDL3_SetGamepadMode().
2627
// 2023-11-13: Updated for recent SDL3 API changes.
2728
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
@@ -117,6 +118,11 @@ static void ImGui_ImplSDL3_SetPlatformImeData(ImGuiViewport*, ImGuiPlatformImeDa
117118
r.w = 1;
118119
r.h = (int)data->InputLineHeight;
119120
SDL_SetTextInputRect(&r);
121+
SDL_StartTextInput();
122+
}
123+
else
124+
{
125+
SDL_StopTextInput();
120126
}
121127
}
122128

backends/imgui_impl_sdl3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
1111
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
1212
// Missing features:
13-
// [x] Platform: Basic IME support. Position somehow broken in SDL3 + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
13+
// [ ] Platform: IME SUPPORT IS BROKEN IN SDL3 BECAUSE INPUTS GETS SENT TO BOTH APP AND IME + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
1414

1515
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
1616
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ Breaking changes:
4343

4444
Other changes:
4545

46+
- Backends: SDL3: Fixed text inputs. Re-enable calling SDL_StartTextInput()/SDL_StopTextInput()
47+
as SDL3 no longer enables it by default. (#7452, #6306, #6071, #1953) [@Green-Sky]
48+
4649

4750
-----------------------------------------------------------------------
4851
VERSION 1.90.5 (Released 2024-04-11)

0 commit comments

Comments
 (0)