10015 Commits

Author SHA1 Message Date
Turtle Dove
8f7bc64e89 Merge branch 'fix/defer-texture-destroy-unused-frames' 2026-07-17 11:25:26 -05:00
Turtle Dove
155170262a Backends: DX9, Allegro5, SDLRenderer2, SDLRenderer3: Defer texture destruction until UnusedFrames > 0 (#8597, #9475)
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).
2026-07-17 11:25:20 -05:00
Turtle Dove
c6bcb4e838 docs: Update README with 3 merged PRs, WASM demo, Go bindings, Widget Playground
- 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
2026-07-16 08:38:38 -05:00
Turtle Dove
577079c4fd Merge branch 'fix/opengl2-texture-destroy-unused-frames' 2026-07-16 08:31:45 -05:00
Turtle Dove
d424c48c1b OpenGL2: Defer texture destruction until UnusedFrames > 0 (#9475)
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.
2026-07-16 08:28:39 -05:00
Turtle Dove
d477df2a0e Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	backends/imgui_impl_android.cpp
#	backends/imgui_impl_opengl2.cpp
#	backends/imgui_impl_opengl3.cpp
#	backends/imgui_impl_sdl2.cpp
#	docs/CHANGELOG.txt
2026-07-16 07:34:03 -05:00
ocornut
baeea39c1a Settings: fixed issues caliing ClearWindowSettings() followed by LoadIniSettingsFromMemory().
While not done with core, this would be useful to load .ini over a clean slate.
2026-07-15 19:22:44 +02:00
ocornut
0ff4a8a900 Backends: OpenGL2/3: Backup and restore GL_UNPACK state in UpdateTexture(). Amends. (#9473, #8802)
Fix setting GL_UNPACK_ROW_LENGTH twice.
2026-07-15 18:20:05 +02:00
Turtle Dove
e3927dc004 Backends: OpenGL2/3: Backup and restore GL_UNPACK state in UpdateTexture() (#9473, #8802) 2026-07-15 18:16:57 +02: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
Turtle Dove
7525993267 Merge branch 'fix/android-touch-release-clear-mouse' 2026-07-15 09:38:07 -05:00
Turtle Dove
af8bfcbaed Android: Clear mouse pos on touch release (#6627), SDL2: Restore StartTextInput for Android (#7636)
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.
2026-07-15 09:37:12 -05:00
Turtle Dove
f9e9c980c9 Merge branch 'fix/opengl-state-restore-update-texture' 2026-07-15 08:15:44 -05:00
Turtle Dove
3822055e72 OpenGL2/3: Backup and restore GL_UNPACK state in UpdateTexture() (#9473)
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)
2026-07-15 07:58:39 -05:00
Turtle Dove
451728c700 Merge remote-tracking branch 'upstream/master' 2026-07-15 07:53:49 -05:00
Turtle Dove
0302703a7d
CI: Android: Gradle 9.4.1 via setup-gradle action for AGP 9.2.0 (#8878) (#9467) 2026-07-15 14:36:59 +02:00
ShiroKSH
0720d59bb7 Tables: validate ini settings column count. (#9472)
+ Amend with comment by ocornut.
2026-07-15 14:16:31 +02:00
ocornut
addbfa5021 Settings: fixed ConfigIniSettingsAutoDiscardMonths not calling Cleanup (#9460, #9471) 2026-07-15 13:57:48 +02:00
ocornut
bad1ee71f8 Backends: SDL_Renderer3: fixed changing scale mode not actually working on all platforms. (#7616, #9470, #9378) 2026-07-15 13:44:03 +02:00
ShiroKSH
003ee19d9e Backends: SDL_Renderer3: fixed default sampler not being Linear. (#7616, #9470, #9378) 2026-07-15 13:44:01 +02:00
Turtle Dove
192b5c995b ci: Fix WASM build — sed the Makefile instead of passing LDFLAGS on CLI
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.
2026-07-14 23:29:27 -05:00
Turtle Dove
5a7279bcf0 ci: Add WASM build + deploy workflow for live ImGui web demo
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.
2026-07-14 23:21:15 -05:00
Turtle Dove
1cd495b522 feat: Add Go (cgo) bindings for Dear ImGui + example
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).
2026-07-14 23:15:33 -05:00
Turtle Dove
42b5a2b2a2 docs: Update README with PR links/demo badges, add CODE_OF_CONDUCT and issue templates
- README.md: Updated with live demo links, PR table, badge shields,
  backend improvement summary, and simplified structure
- CODE_OF_CONDUCT.md: Contributor Covenant v2.1
- .github/ISSUE_TEMPLATE/: Bug report and feature request templates
2026-07-14 13:15:19 -05:00
Turtle Dove
5e11619353 feat: add Pixel OS Model Demo — interactive phone simulator
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.
2026-07-13 13:39:43 -05:00
Turtle Dove
2cf50a523a docs: Add README.md and CONTRIBUTING.md for fork
- README.md: Fork overview, sync status, active contribution branches,
  quick start, upstream resources, license/credits
- CONTRIBUTING.md: Guidelines for reporting issues, submitting PRs,
  syncing with upstream, branch strategy, areas needing help
2026-07-13 08:13:45 -05:00
ocornut
b62bfd6b06 InputText: reworked io.ConfigInputTextEnterKeepActive mode so that pressing Ctrl+Enter or Shift+Enter still allows to deactivate.
cc #9239
2026-07-10 21:36:43 +02:00
ocornut
da137cbbb0 (Breaking) Drag and Drop: commented out legacy name ImGuiDragDropFlags_SourceAutoExpirePayload. Use ImGuiDragDropFlags_PayloadAutoExpire. 2026-07-08 18:40:29 +02:00
ocornut
9bb131fb2f CI: enable Metal4 examples. (#9466, #9451)
(Untested)
2026-07-08 18:28:37 +02:00
Jonathan Hoffstadt
62399b5bfe Examples: Apple + Metal4: add example (#9466, #9451)
+ Amend edit to EXAMPLES.md, comment build.xml
2026-07-08 18:04:30 +02:00
ocornut
68fce9f3bd Settings: added DiscardAll option to CleanupIniSettings() / ImGuiSettingsCleanupArgs. (#9460)
+ Demo: tweak for scaling.
2026-07-08 15:03:19 +02:00
ocornut
f903a7e8e2 Settings: fixed Windows not honoring DiscardWhenMissingDate. (#9460) 2026-07-07 22:52:47 +02:00
ocornut
112d6d9eab Settings: added a type name filter to CleanupIniSettings() / ImGuiSettingsCleanupArgs. Amends. (#9460)
Request hash because storing const char* strings in struct is not entirely zen. Amend 2c49da4.
2026-07-07 22:30:15 +02:00
ocornut
2c49da44be Settings: added a type name filter to CleanupIniSettings() / ImGuiSettingsCleanupArgs. (#9460) 2026-07-07 22:18:01 +02:00
ocornut
85593d0869 Tables, Settings: make TableSettingsCreate() recycle existing unbound entry (might happen after a GC or anything clearing table->SettingsOffset. (#9460, #9108) 2026-07-07 22:06:43 +02:00
ocornut
d1eb8d031c Settings: added explicit DiscardWhenMissingDate. (#9460, #9108) 2026-07-07 22:00:26 +02:00
Kian
481f2cea17 Backends: Metal4: added ImTextureID tex_id to residency set. (#9461, #9458, #9451)
This will resolve runtime errors identified by XCode's Metal Shader Validator.
2026-07-07 16:35:23 +02:00
Kian
520a29dd51 Backends: Metal4: added metal-cpp support. (#9461)
with amends.
2026-07-07 16:29:02 +02:00
ocornut
cfdc953ba9 ColorPicker: added option to fix Saturation/Value triangle in wheel picker. Amends. (#9337)
The heat makes this week really not good with human mistakes I guess.
2026-07-07 16:21:36 +02:00
ocornut
f626c1c793 ColorPicker: added option to fix Saturation/Value triangle in wheel picker. Amends. (#9337)
ConfigColorPickerRotateTriangle -> !ImGuiColorEditFlags_PickerNoRotate
2026-07-07 16:18:34 +02:00
ocornut
5d56c09432 ColorPicker: added option to fix Saturation/Value triangle in wheel picker. Amends. (#9337) 2026-07-07 16:14:13 +02:00
SeanTheBuilder1
0785cdb2bb ColorPicker: added option to fix Saturation/Value triangle in wheel picker. (#9337) 2026-07-07 16:14:11 +02:00
ocornut
aca69173df (Breaking) ColorEdit: obsoleted SetColorEditOptions() function in favor of poking to io.ConfigColorEditFlags. (Amend 0e479b9, 9f7d808)
Apologies, 9f7d808 was extremely flaky.
2026-07-07 16:10:35 +02:00
ocornut
9f7d8086fe (Breaking) ColorEdit: obsoleted SetColorEditOptions() function in favor of poking to io.ColorEditFlags. (Amend 0e479b9)
Reordered IO fields breaks ABI backward compat which was never guaranteed. Occasional breaking is a good way to enforce that lack of guarantee!
2026-07-06 16:02:17 +02:00
ocornut
0e479b9554 (Breaking) ColorEdit: obsoleted SetColorEditOptions() function in favor of poking to style.ColorEditFlags. 2026-07-06 15:34:13 +02:00
ocornut
776bf2ab0d Examples: OpenGL3+Win32: rework OpenGL initialization to allow Wine compatibility. Fix. (#9427, #6577)
Fixed commented out test code.
2026-07-03 18:59:37 +02:00
ocornut
4f1ea369ea Examples: OpenGL3+Win32: rework OpenGL initialization to allow Wine compatibility. (#9427, #6577) 2026-07-03 18:57:14 +02:00
ocornut
a977144955 Examples: OpenGL3+GLFW,SDL2,SDL3: improve Wine compatibility by passing empty GLSL version to ImGui_ImplOpenGL3_Init(). (#9427, #6577) 2026-07-03 18:57:10 +02:00
ocornut
e616ace74d CI, Backends: Metal4: fixed CI, added comments. (#9458) 2026-07-03 17:48:11 +02:00