Skip to content

backend: a dvui.osWindow is an OS window of its own, from the one frame - #366

Merged
foxnne merged 1 commit into
mainfrom
backend/os-window-floats
Oct 10, 2026
Merged

foxnne merged 1 commit into
mainfrom
backend/os-window-floats

Conversation

@foxnne

@foxnne foxnne commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Part of #281: the dvui-native way to put content in an OS window on fizzy's backend. A plain dvui app now calls dvui.osWindow(...), dvui's own API, and on fizzy's backend gets an OS window drawn from the one dvui.Window. It needs no viewports code and no reaching into dvui internals. On any other backend, dvui does what it does today.

How

dvui (fork, tag fizzy-sdk-0.2.23; docs/DEPENDENCIES.md patches 7 and 8):

  • Patch 7: a child OS window is deinit before its backend. Closing a dvui.osWindow crashed on any backend with secondary windows.
  • Patch 8: where a backend makes no secondary dvui.Window, dvui.osWindow falls back to a floating window. That window now takes the requested size, min/max size and id_extra, gets a close button on the window's open_flag, and cascades past windows already there (the fallback's own TODOs). The backend also hears of it each frame (Backend.osWindowFloating: its id, the header it moves by, the options).

Fizzy's backend:

  • It drops initWindowSecondary, which it only inherited from dvui's SDL backend, so every dvui.osWindow takes the fallback.
  • SDLBackend.osWindowFloating notes each fallback window as it draws.
  • The new backend/src/os_windows.zig does around the app's frame (in appIterate) what example-app's run-dvui did by hand:
    • the window's rect moves into a viewport's band (_rect);
    • the band becomes a dvui screen;
    • the OS window is placed, given drag hints from the dvui header (its close button excepted), and handed its picture (viewports.Picture, .app framing);
    • the pointer is pinned while dvui resizes the window.
  • It opens a window only once dvui has sized and placed the floating window (_auto_pos). Opening earlier put it off-screen.

Fizzy's own Popout is untouched: it uses viewports directly and never dvui.osWindow. os_windows sets screens only when it has windows of its own, so it doesn't override Popout's.

Verification

  • The plugin fingerprint is unchanged (test-sdk-version), so no SDK release is needed for the boundary.
  • zig build, test (533/534), test-integration (375/375), check-web, the Windows and Linux cross-builds, -Dnative-backend=sdl3 and the backend's tests (46/46) pass on macOS.
  • scripts/check-examples.sh builds example-app's main (whose run-dvui still drives viewports itself) and example-plugin against this tree, all passing.
  • run-dvui on dvui.osWindow, built against this branch (fizzyedit/example-app, follow-up):
    • two windows open as OS windows of their own, centred over the main window and stepped 24 pt apart;
    • on dvui's SDL3 backend the same code opens dvui's own secondary windows;
    • @foxnne used the earlier version of these windows (dragging, closing, overlapping clicks).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@foxnne
foxnne enabled auto-merge (squash) October 10, 2026 22:50
@foxnne
foxnne merged commit 908dafc into main Oct 10, 2026
10 checks passed
@foxnne
foxnne deleted the backend/os-window-floats branch October 10, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant