class

CArcWindowManager

Module
Arc
Header
#include "Arc/Framework/CArcWindowManager.h"
Namespace
Arcf

Type aliases

AliasDescription
using CContextMenuCallback = std::function<void(const char*, float, float, uint32_t)>
using CShortcutCallback = std::function<bool(int key, bool ctrl, bool shift, bool alt)>
using CDoubleShiftCallback = std::function<void()>Shift tapped twice with no other key between, within kDoubleShiftWindowMs: the design's second way into the command palette.
using COverlayCallback = std::function<void(CArcUIRenderer& renderer, float width, float height)>

Properties

TypeNameDescription
static constexpr int32_tkDoubleShiftWindowMsDefault 400.

Public functions

ReturnsNameDescription
CArcWindowManager&Get
boolInitializeInitialize with an RHI device.
voidShutdown
IArcPlatformBackend*GetPlatformBackend
voidSetModalLoopTickCallbackReplaces the default modal-loop repaint (all Arc-owned windows) with the host's own pump — see IArcPlatformBackend.
boolIsAnyWindowInModalSizeMove
voidSetShaderLoaderShader loading (must be called before CreateWindow).
voidSetShaderFallbackDirectory
CArcWindow*CreateWindowCreate a new window from descriptor.
CArcWindow*CreateFromExistingCreate from an existing platform window.
voidPaintMainWindowPaint the main window's UI into an external command buffer (host owns swapchain + render pass).
voidPaintMainWindowProduce
voidPaintMainWindowRecord
voidDestroyWindow
voidDestroyWindow
CArcWindow*GetMainWindow
CArcWindow*GetWindow
CArcWindow*FindWindowByPlatformID
const std::vector<std::unique_ptr<CArcWindow>>&GetAllWindows
size_tGetLiveWindowCountWindows a frame actually has to paint: parked popups (closed tooltips kept hidden for reuse) and windows already closing are still in GetAllWindows but cost nothing.
boolIsLiveWindowState
size_tGetRetiringWindowCountClosed popup windows hidden and waiting for the GPU to retire their last frames before their swapchain is freed (see RetirePopupWindow).
uint64_tGetRetiredPopupReleaseCountPopup hosts torn down so far by each path: after the GPU retired them (no wait) or immediately with a device-wide idle wait.
uint64_tGetBlockingPopupReleaseCount
doubleGetPopupReleaseMsMilliseconds the game thread spent tearing popup hosts down, summed over every release — what a menu close costs the frame it lands on.
voidSetDeferredPopupRelease
voidSetContextMenuCallback
voidSetShortcutCallback
voidSetDoubleShiftCallback
boolTrackDoubleShiftFeeds one key press to the double-Shift detector; true when it completed a double tap (and the callback ran).
voidSetOverlayCallback
voidProcessEvents
voidRenderAll
voidRenderOwnedWindowsRenders and presents only the Arc-owned swapchain windows, skipping wrapped/external ones, all on the calling thread.
std::vector<FArcOwnedWindowFrame>ProduceOwnedWindowsRenderOwnedWindows in three parts for a host that records on its own rendering thread.
voidRecordOwnedWindows
voidPresentOwnedWindows
voidSetRecordFenceWaits until no produced window frame is still being recorded.
boolHasOwnedWindowsToRenderTrue when RenderOwnedWindows would record at least one window.
boolShouldQuit
voidResetInputState
voidDismissTooltipHides the hover tooltip immediately and keeps it hidden until the pointer moves again.
voidSetOSPopupsEnabledMenus and tooltips as real OS windows (borderless, non-activating, topmost) so they can overhang the owning window like every native app.
boolAreOSPopupsEnabled
voidSetPopupsInWindowWhenTheyFitA menu or tooltip that fits inside its owning window paints there, as Slate does, and only one that must overhang the window gets an OS window of its own.
boolArePopupsInWindowWhenTheyFit
boolPopupFitsInWindowWhether a popup rect in the owner's logical space lies wholly inside the owner window, and so needs no OS window.
uint64_tGetPopupWindowsCreatedOS popup windows created since startup (a test reads how many an interaction cost).
uint64_tGetReentrantPaintsRefusedWindow paints refused because another paint was still on the game thread's stack (a window message arriving mid-frame).
uint64_tGetSharedPipelineWindowsWindows that took an existing window's pipelines and white texture instead of building their own.
boolHasMenuPopupTrue when the menu is currently hosted by a popup OS window (the owning window must then skip its in-window overlay paint).
floatWindowScaleThe window's effective UI scale: the global (main) scale for the main window, the per-window registration for everything else.
boolHandlePlatformEventInject a platform event directly (for host engines that own the SDL event loop).
boolInjectEventInject a raw native platform event (SDL_Event*, MSG*, etc.).
boolWantCaptureMouseCapture-want flags across all windows (incl.
boolWantCaptureKeyboard
const FRouteCounters&GetRouteCounters
voidSetSkipUnchangedWindowsSkips a window's layout, paint and batch snapshot — and the upload of a batch every frame slot already holds — on frames where nothing in it changed: 0 off (every window paints every frame), 1 skip the paint and the upload but still record and present, 2 also leave an owned window that samples nothing live without a record and a present.
int32_tGetSkipUnchangedWindows
const FPaintSkipStats&GetPaintSkipStats
voidSetTextInputAreaCalled by focused text widgets to dock the IME candidate window at their caret.

Function details

Get

C++
static CArcWindowManager& Get()

Initialize

C++
bool Initialize(IArcRHIDevice* device, IArcPlatformBackend* platformBackend = nullptr)

Initialize with an RHI device. If platformBackend is null, creates a default one (SDL3).

Shutdown

C++
void Shutdown()

GetPlatformBackend

C++
IArcPlatformBackend* GetPlatformBackend() const

SetModalLoopTickCallback

C++
void SetModalLoopTickCallback(std::function<void()> callback)

Replaces the default modal-loop repaint (all Arc-owned windows) with the host's own pump — see IArcPlatformBackend.

IsAnyWindowInModalSizeMove

C++
bool IsAnyWindowInModalSizeMove() const

SetShaderLoader

C++
void SetShaderLoader(CArcUIRenderer::CShaderReadFunc loader)

Shader loading (must be called before CreateWindow).

SetShaderFallbackDirectory

C++
void SetShaderFallbackDirectory(const std::string& spvDirectory)

CreateWindow

C++
CArcWindow* CreateWindow(const CArcWindowDesc& desc)

Create a new window from descriptor. Arc creates and owns the OS window.

CreateFromExisting

C++
CArcWindow* CreateFromExisting(std::unique_ptr<IArcPlatformWindow> platformWindow, bool createSwapchain = true, EArcPixelFormat externalColorFormat = EArcPixelFormat::BGRA8)

Create from an existing platform window. Arc renders into it but doesn't own it. Set createSwapchain=false when the host engine owns the swapchain (UE5-style); externalColorFormat must then match the host's render-target format.

PaintMainWindow

C++
void PaintMainWindow(IArcRHICommandBuffer* cmd, uint32_t width, uint32_t height, float deltaTime)

Paint the main window's UI into an external command buffer (host owns swapchain + render pass). The caller must have already begun a render pass on cmd — HDR staging/encode is handled by the host's overlay pass.

PaintMainWindowProduce

C++
void PaintMainWindowProduce(uint32_t width, uint32_t height, float deltaTime)

PaintMainWindowRecord

C++
void PaintMainWindowRecord(IArcRHICommandBuffer* cmd, uint64_t maxSerial = UINT64_MAX)

DestroyWindow

C++
void DestroyWindow(uint32_t windowId)

DestroyWindow

C++
void DestroyWindow(CArcWindow* window)

GetMainWindow

C++
CArcWindow* GetMainWindow() const

GetWindow

C++
CArcWindow* GetWindow(uint32_t id) const

FindWindowByPlatformID

C++
CArcWindow* FindWindowByPlatformID(uint32_t platformWindowId) const

GetAllWindows

C++
const std::vector<std::unique_ptr<CArcWindow>>& GetAllWindows() const

GetLiveWindowCount

C++
size_t GetLiveWindowCount() const

Windows a frame actually has to paint: parked popups (closed tooltips kept hidden for reuse) and windows already closing are still in GetAllWindows but cost nothing. A host deciding whether the frame has more than one window must ask this, or the first tooltip of the session leaves a parked window that never goes away.

IsLiveWindowState

C++
static bool IsLiveWindowState(bool hasPlatformWindow, bool shouldClose, bool parked)

GetRetiringWindowCount

C++
size_t GetRetiringWindowCount() const

Closed popup windows hidden and waiting for the GPU to retire their last frames before their swapchain is freed (see RetirePopupWindow).

GetRetiredPopupReleaseCount

C++
uint64_t GetRetiredPopupReleaseCount() const

Popup hosts torn down so far by each path: after the GPU retired them (no wait) or immediately with a device-wide idle wait.

GetBlockingPopupReleaseCount

C++
uint64_t GetBlockingPopupReleaseCount() const

GetPopupReleaseMs

C++
double GetPopupReleaseMs() const

Milliseconds the game thread spent tearing popup hosts down, summed over every release — what a menu close costs the frame it lands on.

SetDeferredPopupRelease

C++
void SetDeferredPopupRelease(bool deferred)

SetContextMenuCallback

C++
void SetContextMenuCallback(CContextMenuCallback cb)

SetShortcutCallback

C++
void SetShortcutCallback(CShortcutCallback cb)

SetDoubleShiftCallback

C++
void SetDoubleShiftCallback(CDoubleShiftCallback cb)

TrackDoubleShift

C++
bool TrackDoubleShift(EKey key)

Feeds one key press to the double-Shift detector; true when it completed a double tap (and the callback ran).

SetOverlayCallback

C++
void SetOverlayCallback(COverlayCallback cb)

ProcessEvents

C++
void ProcessEvents()

RenderAll

C++
void RenderAll(float deltaTime)

RenderOwnedWindows

C++
void RenderOwnedWindows(float deltaTime)

Renders and presents only the Arc-owned swapchain windows, skipping wrapped/external ones, all on the calling thread. Host engines call it once per frame after PaintMainWindow. Does not tick the animation manager — PaintMainWindow already did.

ProduceOwnedWindows

C++
std::vector<FArcOwnedWindowFrame> ProduceOwnedWindows(float deltaTime)

RenderOwnedWindows in three parts for a host that records on its own rendering thread. Produce runs on the game thread (layout, paint, batch snapshot) and pins each window's batch; Record opens each window's frame, records the pinned batch and closes it; Present hands each recorded window to its swapchain's deferred present. Record and Present touch no widget and no platform window, so they may run on another thread while the game thread produces the next frame. The windows stay alive until the record fence (below) ran.

RecordOwnedWindows

C++
void RecordOwnedWindows(std::vector<FArcOwnedWindowFrame>& frames)

PresentOwnedWindows

C++
void PresentOwnedWindows(const std::vector<FArcOwnedWindowFrame>& frames)

SetRecordFence

C++
void SetRecordFence(std::function<void()> fence)

Waits until no produced window frame is still being recorded. Run before any window's GPU side is torn down; a host recording owned windows on another thread must install it.

HasOwnedWindowsToRender

C++
bool HasOwnedWindowsToRender() const

True when RenderOwnedWindows would record at least one window. A host that must fence its render thread before that recording asks first, so a frame with no floating panel or popup keeps its overlap.

ShouldQuit

C++
bool ShouldQuit() const

ResetInputState

C++
void ResetInputState()

DismissTooltip

C++
void DismissTooltip()

Hides the hover tooltip immediately and keeps it hidden until the pointer moves again. Every mouse press routes through here, as does every popup that opens and every loss of window focus.

SetOSPopupsEnabled

C++
void SetOSPopupsEnabled(bool enabled)

Menus and tooltips as real OS windows (borderless, non-activating, topmost) so they can overhang the owning window like every native app. On by default; when off — or when popup creation fails — the legacy in-window overlay painting takes over.

AreOSPopupsEnabled

C++
bool AreOSPopupsEnabled() const

SetPopupsInWindowWhenTheyFit

C++
void SetPopupsInWindowWhenTheyFit(bool enabled)

A menu or tooltip that fits inside its owning window paints there, as Slate does, and only one that must overhang the window gets an OS window of its own. Each OS popup costs a swapchain, a command buffer and a renderer, and every one of those once drained the GPU on the game thread: the owner's 1-19 s stalls sat next to popup creation and resizes. On by default.

ArePopupsInWindowWhenTheyFit

C++
bool ArePopupsInWindowWhenTheyFit() const

PopupFitsInWindow

C++
static bool PopupFitsInWindow(const CArcWindow* owner, const ArcRect& rect)

Whether a popup rect in the owner's logical space lies wholly inside the owner window, and so needs no OS window.

GetPopupWindowsCreated

C++
uint64_t GetPopupWindowsCreated() const

OS popup windows created since startup (a test reads how many an interaction cost).

GetReentrantPaintsRefused

C++
uint64_t GetReentrantPaintsRefused() const

Window paints refused because another paint was still on the game thread's stack (a window message arriving mid-frame).

GetSharedPipelineWindows

C++
uint64_t GetSharedPipelineWindows() const

Windows that took an existing window's pipelines and white texture instead of building their own. The first window to build a set leaves it held here, so every later popup shares it even after that window closed.

HasMenuPopup

C++
bool HasMenuPopup(const AMenu* menu) const

True when the menu is currently hosted by a popup OS window (the owning window must then skip its in-window overlay paint).

WindowScale

C++
float WindowScale(const CArcWindow* win) const

The window's effective UI scale: the global (main) scale for the main window, the per-window registration for everything else.

HandlePlatformEvent

C++
bool HandlePlatformEvent(const CArcPlatformEvent& event)

Inject a platform event directly (for host engines that own the SDL event loop). Call this instead of ProcessEvents() when the host polls SDL events itself. Returns true when the UI consumed the event — a widget handled it, a modal or menu owned it, or the focused widget swallowed it. A widget that merely has focus or is merely hovered consumes nothing.

InjectEvent

C++
bool InjectEvent(const void* nativeEvent, bool* outConsumed = nullptr)

Inject a raw native platform event (SDL_Event*, MSG*, etc.). Delegates to the active platform backend's TranslateNativeEvent(), then dispatches. Returns true if the event was RECOGNIZED (translated); pass outConsumed to also learn whether the UI actually consumed it. The two answers differ for every event Arc routed and nobody took.

WantCaptureMouse

C++
bool WantCaptureMouse() const

Capture-want flags across all windows (incl. open menus/modals) — for host engines arbitrating input between coexisting UI stacks.

WantCaptureKeyboard

C++
bool WantCaptureKeyboard() const

GetRouteCounters

C++
const FRouteCounters& GetRouteCounters() const

SetSkipUnchangedWindows

C++
void SetSkipUnchangedWindows(int32_t mode, uint32_t verifyFrames)

Skips a window's layout, paint and batch snapshot — and the upload of a batch every frame slot already holds — on frames where nothing in it changed: 0 off (every window paints every frame), 1 skip the paint and the upload but still record and present, 2 also leave an owned window that samples nothing live without a record and a present. verifyFrames: a skipping window paints anyway after this many skipped frames and compares the result with what it was replaying.

GetSkipUnchangedWindows

C++
int32_t GetSkipUnchangedWindows() const

GetPaintSkipStats

C++
const FPaintSkipStats& GetPaintSkipStats() const

SetTextInputArea

C++
void SetTextInputArea(const AWidget* focusedWidget, const ArcRect& logicalRect, float cursorOffsetX)

Called by focused text widgets to dock the IME candidate window at their caret. rect in logical UI units; routed to the window whose input processor currently focuses the widget.

Generated from Arc/Framework/CArcWindowManager.h via arc.json · Nov 5, 2026Version 1.0.0