|
@@ -22,6 +22,10 @@
|
|
|
|
|
|
// CHANGELOG
|
|
// CHANGELOG
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
|
+// 2024-06-26: Update for SDL3 api changes: SDL_StartTextInput()/SDL_StopTextInput()/SDL_SetTextInputRect() functions signatures.
|
|
|
|
+// 2024-06-24: Update for SDL3 api changes: SDL_EVENT_KEY_DOWN/SDL_EVENT_KEY_UP contents.
|
|
|
|
+// 2024-06-03; Update for SDL3 api changes: SDL_SYSTEM_CURSOR_ renames.
|
|
|
|
+// 2024-05-15: Update for SDL3 api changes: SDLK_ renames.
|
|
// 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.
|
|
// 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.
|
|
// 2024-02-13: Inputs: Fixed gamepad support. Handle gamepad disconnection. Added ImGui_ImplSDL3_SetGamepadMode().
|
|
// 2024-02-13: Inputs: Fixed gamepad support. Handle gamepad disconnection. Added ImGui_ImplSDL3_SetGamepadMode().
|
|
// 2023-11-13: Updated for recent SDL3 API changes.
|
|
// 2023-11-13: Updated for recent SDL3 API changes.
|
|
@@ -76,6 +80,9 @@ struct ImGui_ImplSDL3_Data
|
|
Uint64 Time;
|
|
Uint64 Time;
|
|
char* ClipboardTextData;
|
|
char* ClipboardTextData;
|
|
|
|
|
|
|
|
+ // IME handling
|
|
|
|
+ SDL_Window* ImeWindow;
|
|
|
|
+
|
|
// Mouse handling
|
|
// Mouse handling
|
|
Uint32 MouseWindowID;
|
|
Uint32 MouseWindowID;
|
|
int MouseButtonsDown;
|
|
int MouseButtonsDown;
|
|
@@ -116,8 +123,15 @@ static void ImGui_ImplSDL3_SetClipboardText(void*, const char* text)
|
|
SDL_SetClipboardText(text);
|
|
SDL_SetClipboardText(text);
|
|
}
|
|
}
|
|
|
|
|
|
-static void ImGui_ImplSDL3_SetPlatformImeData(ImGuiViewport*, ImGuiPlatformImeData* data)
|
|
|
|
|
|
+static void ImGui_ImplSDL3_SetPlatformImeData(ImGuiViewport* viewport, ImGuiPlatformImeData* data)
|
|
{
|
|
{
|
|
|
|
+ ImGui_ImplSDL3_Data* bd = ImGui_ImplSDL3_GetBackendData();
|
|
|
|
+ SDL_Window* window = (SDL_Window*)viewport->PlatformHandle;
|
|
|
|
+ if ((data->WantVisible == false || bd->ImeWindow != window) && bd->ImeWindow != NULL)
|
|
|
|
+ {
|
|
|
|
+ SDL_StopTextInput(bd->ImeWindow);
|
|
|
|
+ bd->ImeWindow = nullptr;
|
|
|
|
+ }
|
|
if (data->WantVisible)
|
|
if (data->WantVisible)
|
|
{
|
|
{
|
|
SDL_Rect r;
|
|
SDL_Rect r;
|
|
@@ -125,12 +139,9 @@ static void ImGui_ImplSDL3_SetPlatformImeData(ImGuiViewport*, ImGuiPlatformImeDa
|
|
r.y = (int)data->InputPos.y;
|
|
r.y = (int)data->InputPos.y;
|
|
r.w = 1;
|
|
r.w = 1;
|
|
r.h = (int)data->InputLineHeight;
|
|
r.h = (int)data->InputLineHeight;
|
|
- SDL_SetTextInputRect(&r);
|
|
|
|
- SDL_StartTextInput();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- SDL_StopTextInput();
|
|
|
|
|
|
+ SDL_SetTextInputRect(window, &r);
|
|
|
|
+ SDL_StartTextInput(window);
|
|
|
|
+ bd->ImeWindow = window;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|