Problem
WindowManager supports creating and destroying secondary windows, but the built-in Pencuil path remains tied to the primary window:
- UsePencuil registers one Pencil, PencilSystem, PencuilRenderer, and render phase for the application.
- PencilSystem receives the primary Window from dependency injection and uses its viewport.
- PencuilRenderer initializes its render targets and pipelines from WindowManager.PrimaryWindow.
- DefaultRenderContextProvider acquires only the primary window swapchain.
- Mouse window-presence tracking is limited to the primary window, while mouse and keyboard subscriptions do not expose enough window context to isolate interaction by window.
- TextInputService has window-specific operations, but PencilSystem uses the parameterless primary-window operations.
As a result, a consumer can create a secondary window but cannot attach an interactive Pencuil UI to it through the normal application-builder and render-orchestration APIs. Manual secondary-window rendering does not solve input routing or independent Pencuil state.
This blocks common secondary-window uses such as developer tools, inspectors, editors, and control panels.
Desired behavior
Provide a supported way to host an independent Pencuil UI in a selected Window, including:
- independent Pencil state and viewport per host window;
- rendering to that window through GameKit render orchestration;
- mouse, keyboard, and text input routed to the correct window;
- clean handling when a secondary window is closed and later recreated;
- unchanged behavior for existing single-window applications.
The consumer-facing API should make the target window explicit rather than requiring replacement of Pencuil internals or the application render loop.
Context
This is a follow-up to #248. The initial multi-window implementation added window lifecycle management and a manual-rendering tutorial while intentionally leaving default rendering, Pencuil, and MouseService primary-window-only.
Problem
WindowManager supports creating and destroying secondary windows, but the built-in Pencuil path remains tied to the primary window:
As a result, a consumer can create a secondary window but cannot attach an interactive Pencuil UI to it through the normal application-builder and render-orchestration APIs. Manual secondary-window rendering does not solve input routing or independent Pencuil state.
This blocks common secondary-window uses such as developer tools, inspectors, editors, and control panels.
Desired behavior
Provide a supported way to host an independent Pencuil UI in a selected Window, including:
The consumer-facing API should make the target window explicit rather than requiring replacement of Pencuil internals or the application render loop.
Context
This is a follow-up to #248. The initial multi-window implementation added window lifecycle management and a manual-rendering tutorial while intentionally leaving default rendering, Pencuil, and MouseService primary-window-only.