Merge branch 'fix/android-touch-release-clear-mouse'

This commit is contained in:
Turtle Dove 2026-07-15 09:38:07 -05:00
commit 7525993267
3 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2026-07-15: Inputs: Clear mouse position on touch release (AMOTION_EVENT_ACTION_UP) to prevent buttons from staying in hovered/pressed state. (#6627)
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
@ -230,6 +231,10 @@ int32_t ImGui_ImplAndroid_HandleInputEvent(const AInputEvent* input_event)
{
io.AddMousePosEvent(AMotionEvent_getX(input_event, event_pointer_index), AMotionEvent_getY(input_event, event_pointer_index));
io.AddMouseButtonEvent(0, event_action == AMOTION_EVENT_ACTION_DOWN);
// Clear mouse position on touch release so buttons don't stay in hovered state. (#6627)
// On touchscreens there is no "hover" — after release the pointer is gone.
if (event_action == AMOTION_EVENT_ACTION_UP)
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
}
break;
}

View File

@ -21,6 +21,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2026-07-15: Platform: Restore SDL_StartTextInput()/SDL_StopTextInput() in IME handler for on-screen keyboard support on Android/mobile. (#7636)
// 2026-04-16: Made ImGui_ImplSDL2_GetContentScaleForWindow(), ImGui_ImplSDL2_GetContentScaleForDisplay() helpers return a minimum of 1.0f, as some Linux setup seems to report <1.0f value and this breaks scaling border size. (#9369)
// 2026-02-13: Inputs: systems other than X11 are back to starting mouse capture on mouse down (reverts 2025-02-26 change). Only X11 requires waiting for a drag by default (not ideal, but a better default for X11 users). Added ImGui_ImplSDL2_SetMouseCaptureMode() for X11 debugger users. (#3650, #6410, #9235)
// 2026-01-15: Changed GetClipboardText() handler to return nullptr on error aka clipboard contents is not text. Consistent with other backends. (#9168)
@ -205,6 +206,13 @@ static void ImGui_ImplSDL2_PlatformSetImeData(ImGuiContext*, ImGuiViewport*, ImG
r.w = 1;
r.h = (int)data->InputLineHeight;
SDL_SetTextInputRect(&r);
// SDL_StartTextInput() is needed on Android (and some other platforms) to show the on-screen keyboard. (#7636)
// It was removed in a7703fe6 due to concerns about its relation to desktop IME, but is required on mobile.
SDL_StartTextInput();
}
else
{
SDL_StopTextInput();
}
}

View File

@ -150,6 +150,10 @@ Other Changes:
- Misc:
- Added IM_DEBUG_BREAK() handler for GCC+AArch64/ARM64. [@tom-seddon]
- Backends:
- Android: Clear mouse position on touch release (AMOTION_EVENT_ACTION_UP)
to prevent buttons from staying in hovered/pressed state. (#6627)
- SDL2: Restore SDL_StartTextInput()/SDL_StopTextInput() in IME handler
for on-screen keyboard support on Android. (#7636)
- Metal4:
- Added new Metal 4 backend (forked from Metal 3 backend). (#9458, #9451) [@AmelieHeinrich]
- Added Metal-cpp support enabled with `IMGUI_IMPL_METAL_CPP` define. (#9461) [@MERL10N]