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.
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.
- PR #9475 now covers DX9, Allegro5, SDLRenderer2, SDLRenderer3 (not just OpenGL2)
- Linked to Issue #8597 (multi-threaded render domain safety)
- Updated bug fix summary with full backend list
These four backends were missing the UnusedFrames > 0 check in their
UpdateTexture() WantDestroy branch, inconsistent with all other backends
(OpenGL2, OpenGL3, DX10, DX11, DX12, Vulkan, WGPU, SDLGPU3) which already
defer destruction until the texture is no longer in flight.
This is a potential use-after-free in multi-threaded/staged rendering
pipelines where the UI thread may destroy a texture while the render thread
is still drawing with it. Per #8597 guidance: backends should defer
destroying by the amount of in-flight frames in their rendering pipeline.
The fix adds '&& tex->UnusedFrames > 0' to the WantDestroy condition,
matching the exact pattern used by OpenGL3, DX10, DX11, WGPU, and SDLGPU3.
Companion to #9475 (OpenGL2 fix, already merged).
- PR status table now shows 3 merged (brightgreen badge)
- Added Live WASM demo link (actual ImGui in browser)
- Added Widget Playground demo link
- Added Go bindings section
- Updated bug fix summary with merged fixes
The OpenGL2 backend was immediately destroying textures on
ImTextureStatus_WantDestroy without checking tex->UnusedFrames > 0,
unlike ALL other backends (OpenGL3, DX11, DX12, Metal, Vulkan, WebGPU)
which defer destruction until the texture is no longer in use by the GPU.
This could cause a use-after-free if the texture was still referenced by
in-flight draw commands when it was destroyed.
Fix: Add '&& tex->UnusedFrames > 0' to the WantDestroy check, matching
the pattern used by OpenGL3, DX11, Metal, Vulkan, and WebGPU.
Android backend (imgui_impl_android.cpp):
- After AMOTION_EVENT_ACTION_UP for FINGER/UNKNOWN input, clear mouse
position via AddMousePosEvent(-FLT_MAX, -FLT_MAX). This prevents buttons
from staying in hovered/pressed state after touch release. On touchscreens
there is no hover — the pointer is gone after release. (#6627)
- Omar confirmed this is the right approach in issue comments: 'the backend
should submit a mouse leaving event after the touch release'
SDL2 backend (imgui_impl_sdl2.cpp):
- Restore SDL_StartTextInput()/SDL_StopTextInput() in the IME handler
(ImGui_ImplSDL2_PlatformSetImeData). These calls were removed in a7703fe6
due to concerns about desktop IME, but are required on Android to show
the on-screen keyboard when InputText is focused. The equivalent fix was
already applied to SDL3 in fab96a6e but not SDL2. (#7636)
Both fixes are referenced in docs/CHANGELOG.txt.
The OpenGL2 and OpenGL3 backends set GL_UNPACK_ROW_LENGTH=0 and
GL_UNPACK_ALIGNMENT=1 during texture creation and updates, but
never restored the original values. This corrupted the calling
application's pixel store state when ImGui created or updated
textures mid-frame (e.g., dynamic font atlas updates).
Fix: Backup GL_UNPACK_ROW_LENGTH and GL_UNPACK_ALIGNMENT at the
start of UpdateTexture(), and restore them at the end.
This resolves the FIXME in ImGui_ImplOpenGL3_UpdateTexture():
'FIXME: Consider backing up and restoring'
Issues: #8802 (original UNPACK_ALIGNMENT change), #9473 (this fix)
The make command was failing because LDFLAGS+='' doesn't properly override
the Makefile's appended flags. Instead, use sed to:
1. Replace shell_minimal.html with shell_imgui_xl.html
2. Uncomment the -sSINGLE_FILE line
Also added keep_files: true and destination_dir: wasm to the deploy step
so the existing gh-pages content is preserved.
Add .github/workflows/deploy-wasm.yml that:
- Installs Emscripten SDK on ubuntu-latest
- Builds example_sdl2_opengl3 with Makefile.emscripten using -sSINGLE_FILE
(all WASM+JS embedded in a single .html file, no separate .wasm/.js)
- Uses custom shell_imgui_xl.html with loading spinner and WebGL context
loss handling
- Deploys to gh-pages/wasm/ directory via peaceiris/actions-gh-pages
The resulting live demo at turtle-pb.github.io/imgui_xl/wasm/index.html
will show the ACTUAL Dear ImGui demo window running in the browser via
WebAssembly — not a canvas simulation, but real compiled C++ ImGui.
Triggers on pushes to master that touch ImGui source files, the SDL2/
OpenGL3 backend, the example, or the shell template.
Also supports manual workflow_dispatch.
bindings/go/:
- imgui_bridge.h/.cpp: Thin C API bridge (extern C) wrapping C++ ImGui
- imgui.go: Go cgo package (CreateContext, NewFrame, Begin, Button,
SliderFloat, SliderInt, Checkbox, ColorEdit3, Text, Combo, etc.)
- go.mod: Module definition
- README.md: Full docs with usage, building, and API reference
examples/example_golang/:
- main.go: Null-mode example showing ImGui from Go
- go.mod: Module with replace directive for local bindings
- Makefile: Build/run/clean targets
Go 1.26.5 verified working on this host. CGO_ENABLED=1 required
(plus a C++ compiler like g++ for the bridge compilation).
Add a fully self-contained Pixel 8 Pro phone simulator that showcases
Pixel OS capabilities in any browser. Includes:
- Working menu bar (File, View, Tools, Help) with keyboard shortcuts
- Lock screen with live clock, notifications, fingerprint/swipe unlock
- Home screen with Material You design, Google search, weather widget
- 7 functional apps: Phone, Messages, Camera, Settings, Clock, Photos, Browser
- Quick Settings panel with 8 toggle tiles + brightness slider
- Recents app switcher
- Dark mode toggle and 6-theme color switcher
- Mouse + touch gesture support (swipe up for home, swipe down for QS)
- Bottom status bar showing demo state
All functions work — every menu item, button, toggle, and gesture
is wired to a real handler. No build step, no dependencies.
Part of imgui_xl examples.
Backend improvements (imgui_impl_android.h/.cpp):
- Moved JNI soft-keyboard and Unicode char polling from the example into the backend.
The backend automatically shows/hides the soft keyboard based on io.WantTextInput
during NewFrame().
- Moved JNI Unicode character polling from the example into the backend.
Characters are polled and fed to io.AddInputCharacter() automatically.
- Added clipboard support via JNI to Android ClipboardManager.
io.SetClipboardTextFn / io.GetClipboardTextFn are now set by the backend.
- Added ImGui_ImplAndroid_ShowSoftKeyboard() / HideSoftKeyboard() public API.
- Init() now accepts optional asset_manager and native_activity params.
When native_activity is provided, JNI features are enabled automatically.
When nullptr, the backend degrades gracefully (no keyboard/clipboard).
- Added sensor support via NDK ASensor API (no JNI needed):
Accelerometer, Gyroscope, Magnetometer, Light, Proximity, Pressure,
Humidity, Ambient Temperature.
API: EnableSensor(), DisableSensor(), GetSensorData(), IsSensorAvailable().
Sensor events are drained non-blocking in NewFrame().
- Added display metrics via JNI:
DPI, density, xdpi/ydpi, refresh rate, orientation, resolution.
API: GetDisplayMetrics().
Used to auto-scale ImGui style to the device's actual density.
Example cleanup (main.cpp):
- Removed ~120 lines of JNI boilerplate (ShowSoftKeyboardInput, PollUnicodeChars,
GetAssetData). The example is now a clean Init -> Loop -> Render -> Shutdown.
- Single ImGui_ImplAndroid_Init() call passes the activity object; the backend
handles the rest.
- Added sensor window: live accelerometer, gyroscope, magnetometer, light, proximity
readouts with visual progress bars.
- Added display window: resolution, DPI, density, refresh rate, orientation.
- Uses actual device density for style scaling instead of hardcoded 2.0f.
CMakeLists.txt: added 'sensor' to target_link_libraries for ASensor API.
Kotlin activity (MainActivity.kt):
- Kept the three JNI-bridge methods (showSoftInput/hideSoftInput/pollUnicodeChar)
since Android's native API does not provide these. Cleaned up and documented
that they are called by the backend, not by app code.