imgui-mirror/examples/example_apple_metal4
Ahmidou Lyazidi a21461b2e5
Backends: OSX: keep torn-off viewport windows above the main window
Torn-off (secondary) multi-viewport windows now stay above the main window, but not above
other apps. While the app is active they are independent windows at NSFloatingWindowLevel
(above the main window, but not children — so dragging the main window doesn't drag them).
While the app is inactive they become children of the main window at the normal level:
children are occluded together with the app by other apps, and the window server keeps a
child above its parent at all times, so clicking the main window to reactivate can't flash
it over them for a frame. Relative order is preserved across the transitions, and the main
window is brought forward on activation so the whole app comes up as a unit.

Replaces the previous transient parenting (attach-on-create / detach-on-mouse-release in
ImGui_ImplOSX_UpdateWindow, which is removed). ImGui_ImplOSX_RestackSecondaryWindows is
driven from the app activate/deactivate observers; DestroyWindow now detaches a parented
window before hiding it.

Examples: Metal4: resume rendering on app activation (idle-throttle fix)

Cmd-Tab / clicking to reactivate the app doesn't produce a local input event, so the idle
render throttle left the window on the slow heartbeat for up to ~1s after switching back,
which looked like a lag. Bump the render counter on NSApplicationDidBecomeActive so the
window redraws immediately on activation while keeping the idle CPU savings.
2026-09-25 14:33:22 -07:00
..

iOS / OSX Metal4 example

Introduction

This example shows how to integrate Dear ImGui with Metal4. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9.

Consider basing your work off the example_glfw_metal/ or example_sdl2_metal/ examples. They are better supported and will be portable unlike this one.