28 Commits

Author SHA1 Message Date
Turtle Dove
9b655aa4d5 Android: Address ImRAD review feedback on PR #9469
CRITICAL FIX: Restore NewFrame/Shutdown/GetDisplayMetrics lost in rebase
- File was truncated at line 605 during rebase onto upstream/master
- Restored all three functions with proper implementations

REVIEW FEEDBACK ADDRESSED:
1. Rotation: Re-query display metrics in NewFrame when window resizes
2. Keyboard opt-in: SetJniEnabled(false by default) - app retains control
   - SetKeyboardType() / SetKeyboardAction() for customization
3. Keyboard timing: GetWantTextInput() / ResubmitTextInput() for app control
4. Back button: Hides soft keyboard when visible (consumes event)
5. Unicode input: Kept as optional JNI plumbing (app decides when to poll)
6. GetAssetData: Documented in PR_9469_REVIEW_RESPONSE.md (restore in main.cpp)
7. TERM_WINDOW: Documented (EGL surface lifecycle fix in main.cpp)
8. NavBar/insets: GetNavBarHeight() + GetBottomInset() (DisplayCutout API 28+)
   Long press: SetLongPressCallback() + SetLongPressDuration()
   Pressure: Full pressure sensitivity system

PRESSURE SENSITIVITY:
- Per-pointer pressure tracking (up to 10 pointers)
- GetTouchPressure(pointer_id) API
- SetPressureEnabled() / SetPressureThreshold()
- Long-press requires sustained min pressure (not just timer)
- Pressure-weighted scrolling (firmer press = faster scroll)
- Move events update pressure and cancel long-press if pressure drops

All APIs are opt-in. Default behavior preserves pre-PR #9469 app control.
2026-07-18 23:43:10 -05:00
Turtle Dove
372066e249 Android: Move JNI keyboard/clipboard into backend, add display metrics (#3446)
Backend improvements (imgui_impl_android.h/.cpp):
- Moved JNI soft-keyboard and Unicode char polling from the example into
  the backend. The application no longer needs any JNI boilerplate.
- Added clipboard support via JNI to Android ClipboardManager. (#7259)
- Added display metrics (DPI, density, refresh rate, orientation) via JNI.
  Used by the example to set main_scale from actual device density instead
  of hardcoded 2.0f.
- BREAKING CHANGE: ImGui_ImplAndroid_Init() now takes additional
  asset_manager and native_activity parameters. See before/after in header.

Example (main.cpp):
- Removed ShowSoftKeyboardInput() and PollUnicodeChars() JNI helpers (~120 lines).
- Removed their forward declarations and per-frame calls.
- Updated Init() call to new signature.
- Use ImGui_ImplAndroid_GetDisplayMetrics() for main_scale.
- All other comments, EGL block, GetAssetData, APP_CMD cases unchanged.

MainActivity.kt: unchanged (same 3 JNI bridge methods, now called by backend).

docs/CHANGELOG.txt: Added entries for backend and example changes.
2026-07-18 21:05:30 -05:00
Turtle Dove
35a7e8e864 Backends: SDL2: restore SDL_StartTextInput()/SDL_StopTextInput() calls on Android (#7636, #9474) 2026-07-15 17:59:25 +02:00
Turtle Dove
909082890a Backends: Android: clear mouse position on touch release. (#6627, #9474) 2026-07-15 17:36:39 +02:00
ocornut
979c7d76ab Backends: SDL2, SDL3, OSX: Fill gamepad inputs and set ImGuiBackendFlags_HasGamepad regardless of ImGuiConfigFlags_NavEnableGamepad being set. (#8508) 2025-03-21 15:42:47 +01:00
ocornut
43fbd7ce84 Backends: standardized top of file comments. 2024-12-05 12:43:04 +01:00
ocornut
6f287dd16d (Breaking) Removed pre-1.87 obsolete io.KeyMap[], io.KeysDown[], io.NavInputs[]. Remove IMGUI_DISABLE_OBSOLETE_KEYIO. (#4921) 2024-11-06 17:54:59 +01:00
ocornut
5e23680454 Backends: all backends + demo now call IMGUI_CHECKVERSION() to verify ABI compatibility between caller code and compiled version of dear imgui. (#7568) 2024-05-13 15:07:13 +02:00
Anılcan Gülkaya
9a2985611c
Backend: Android: Remove Redundant Check (#7093) 2023-12-06 04:29:40 +01:00
ocornut
888834c636 Backends: Android: Fixed build breaking typo. (#7060)
Amend 86891b0. My bad for not testing this.
2023-11-28 15:23:45 +01:00
ocornut
86891b0986 Backends: Android: ImGui_ImplAndroid_HandleInputEvent() takes a const AInputEvent* (#7060) 2023-11-28 12:08:05 +01:00
ocornut
357f752bed Docs: add more links to the top of every examples and backends files. 2023-09-11 14:01:40 +02:00
ocornut
33e13c85e1 Backends: Made all backends sources files support global IMGUI_DISABLE. (#6601) 2023-07-13 11:27:52 +02:00
Gereon V
055e71518e Backends: clear bits set in io.BackendFlags on backend Shutdown(). Clear BackendPlatformName. (#6334, #6335)
Amended with fix for missing clear for ImGuiBackendFlags_HasGamepad.
2023-04-17 14:57:12 +02:00
David
db4c4e3321
Backends: Android: Added support for io.AddMouseSourceEvent(). (#6315, #6318, #2702, #4921) 2023-04-11 10:01:53 +02:00
ocornut
fd408c9790 Renamed and merged keyboard modifiers key enums and flags into a same set:. ImGuiKey_ModXXX -> ImGuiMod_XXX and ImGuiModFlags_XXX -> ImGuiMod_XXX. (#4921, #456)
Changed signature of GetKeyChordName() to use ImGuiKeyChord.
Additionally SetActiveIdUsingAllKeyboardKeys() doesn't set ImGuiKey_ModXXX but we never need/use those and the system will be changed in upcoming commits.
2022-09-26 10:43:26 +02:00
thedmd
5429f0f6b5 Backends: OSX, Android: Replaced AddKeyModsEvent() added by 790132a in favor of unified key enum system. (#4921, #4858) 2022-01-27 17:46:48 +01:00
thedmd
b8e56dce83 IO: Added AddMousePosEvent(), AddMouseButtonEvent(), AddMouseWheelEvent() api + updated all Backends. (#4858) (input queue code will be next commit)
Details: note that SDL, OSX and GLFW backends removed recording of MouseJustPressed[] which will be unnecessary with input queue (which is the NEXT commit). (#2787, #1992, #3383, #2525, #1320)
2022-01-17 17:35:37 +01:00
ocornut
92c4ff1c2f Rename ImGuiKey_LeftControl to ImGuiKey_LeftCtrl, ImGuiKey_RightControl to ImGuiKey_RightCtrl + made key order match mods order. (#4858) 2022-01-17 15:42:04 +01:00
ocornut
e8172fdfbc Rename io.AddKeyModEvent() -> io.AddKeyModsEvent() and updated backends accordingly. (#2625, #4858)
Amend 790132a (breaking)
2022-01-10 17:00:32 +01:00
ocornut
790132a672 Added io.AddKeyModEvent() and updated backends accordingly. (#2625, #4858) 2022-01-10 15:17:00 +01:00
thedmd
1797135db5 Backends: Android: Update to use io.AddEventKey() will full key map (#2625, #4858) 2022-01-10 15:15:24 +01:00
ocornut
afffcd5810 Inputs: rename ImGuiKey_KeyPadEnter > ImGuiKey_KeypadEnter (#2625) 2022-01-06 14:25:56 +01:00
ocornut
95db098477 ImFontAtlas: move implicit AddFontDefault call to Build() function + remove unnecessary asserts in backend. 2021-06-25 17:27:17 +02:00
ocornut
838c16533d Backends: Comments. 2021-05-27 13:59:35 +02:00
Mertcan Davulcu
cbcd89152b
Backends: Android: Tweaks. (#4034) 2021-05-07 17:43:42 +02:00
ocornut
8dd692c29c Android: Amend backend and examples with minor consistency tweaks. (#3446) 2021-03-04 11:07:03 +01:00
duddel
fb85c0341b
Add Android backend and example (#3446) 2021-03-04 10:35:44 +01:00