Skip to content

Commit 9090828

Browse files
Turtle-PBocornut
authored andcommitted
Backends: Android: clear mouse position on touch release. (#6627, #9474)
1 parent 0302703 commit 9090828

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

backends/imgui_impl_android.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
// CHANGELOG
2525
// (minor and older changes stripped away, please see git history for details)
26-
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
26+
// 2026-07-15: Inputs: clear mouse position on touch release (AMOTION_EVENT_ACTION_UP) to prevent items from staying in hovered state. (#6627, #9474)
27+
// 2022-09-26: Inputs: renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
2728
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
2829
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
2930
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
@@ -230,6 +231,8 @@ int32_t ImGui_ImplAndroid_HandleInputEvent(const AInputEvent* input_event)
230231
{
231232
io.AddMousePosEvent(AMotionEvent_getX(input_event, event_pointer_index), AMotionEvent_getY(input_event, event_pointer_index));
232233
io.AddMouseButtonEvent(0, event_action == AMOTION_EVENT_ACTION_DOWN);
234+
if (event_action == AMOTION_EVENT_ACTION_UP) // (#6627, #9474)
235+
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
233236
}
234237
break;
235238
}

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ Other Changes:
150150
- Misc:
151151
- Added IM_DEBUG_BREAK() handler for GCC+AArch64/ARM64. [@tom-seddon]
152152
- Backends:
153+
- Android:
154+
- Clear mouse position on touch release (AMOTION_EVENT_ACTION_UP) to prevent
155+
items from staying in hovered state. (#6627, #9474) [@Turtle-PB]
153156
- Metal4:
154157
- Added new Metal 4 backend (forked from Metal 3 backend). (#9458, #9451) [@AmelieHeinrich]
155158
- Added Metal-cpp support enabled with `IMGUI_IMPL_METAL_CPP` define. (#9461) [@MERL10N]

0 commit comments

Comments
 (0)