Repository navigation
dvui: run-dvui, dvui's demo and floating windows as OS windows - #4
Merged
Merged
Conversation
`dvui/main.zig` on fizzy's backend through `fizzy.addDvui`; `-Ddvui-backend=sdl3` builds it on dvui's own backend, the floating windows in the main window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 2026
foxnne
added a commit
to fizzyedit/fizzy
that referenced
this pull request
Oct 10, 2026
Part of #281: what example-app's `run-dvui` builds on. Stacked on #326 (on #324); review those first. The example-app side is fizzyedit/example-app#4. **`fizzy.addDvui(fizzy_dep, root_module, backend)`** gives an outside app's module dvui on one of two backends: - `.fizzy`: fizzy's own, where each floating window can be an OS window of its own; - `.sdl3`: dvui's own SDL3 backend, which has the main window only. The module gets `dvui` (fizzy's pin), its `backend`, and `viewports_none` (#324), so the same app code builds on either: ```zig const backend = @import("backend"); const viewports = if (@hasDecl(backend, "viewports")) backend.viewports else @import("viewports_none"); ``` On fizzy's backend it also gets `platform`, and on macOS the backend's Objective-C compiled into it. `build/exe.zig`'s backend switch is now `nativeDvui`, shared by fizzy's own executable and `addDvui`. ## Two fixes a plain dvui app needed 1. **The main window's drawable was acquired with a copy pass still open** (`GpuRenderer.acquireSwapchain`). The frame's texture uploads had left it open, and SDL asserted on every frame ("Cannot acquire a swapchain texture during a pass"). Fizzy never hit this because it draws its frame into a target first. Any dvui app draws straight into the window. The fix ends the copy pass before acquiring, as `presentInto` and `clearPass` already do. 2. **`platform`'s menu-bar exports weren't emitted** (`FizzyMenu*`). `macos/menu_target.m` calls them and is compiled into every macOS app on the backend, but Zig emits an `export fn` only when analysis reaches its file. Fizzy reaches `platform/menu.zig` through its menu bar; a dvui app with none failed to link. Now `platform/root.zig` references them, and they're `pub`. ## Verification - **Fizzy:** `zig build`, `test` (514/515, 1 skipped), `test-integration` (358/358), `check-web`, `test-sdk-version`, the backend's tests (46/46), and the Windows and Linux cross-builds pass on macOS. The soak tape ends in a passing verdict (1,429 viewport presents, no leaks, nothing logged as an error). - **example-app's `run-dvui`, built against this branch, on macOS:** - **On fizzy's backend:** it opens its main window and two floating windows. Each is an OS window of its own, opened over its place in the main window (window list: main at 540,332; floats at 652,476 and 684,500, each 280×212). No assertions or warnings, and it quits cleanly on SIGTERM. - **With `-Ddvui-backend=sdl3`:** the same app shows only its main window, with the floating windows in it. No warnings. - **Not seen:** I couldn't screenshot, since this session has no screen-recording permission. Window positions and the logs are what I checked, not how they look. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each floating window that goes out opens framed by the app (`viewports.Frame.app`): its own header and close button, no OS title bar. Any floating window can go out, by its dvui id, dvui's demo included; fizzy pinned at main with `viewports.Frame` and the overlapping-window press fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foxnne
added a commit
to fizzyedit/fizzy
that referenced
this pull request
Oct 10, 2026
…ds (#343) Part of #281. `scripts/check-examples.sh`, which CI's Linux job runs against each PR's own tree, now also builds example-app's `run-dvui` (fizzyedit/example-app#4, merged), twice: - `zig build dvui`, on fizzy's backend (`fizzy.addDvui`, `viewports`); - `zig build dvui -Ddvui-backend=sdl3`, the same code on dvui's own SDL3 backend through `viewports_none`. A change to the backend package's `viewports`, `Picture`, `Frame` or the stand-in that would break a plain dvui app now fails here before it lands, as the shapes and the replay app already do. **Verification:** `EXAMPLES_DIR=~/dev/fizzyedit scripts/check-examples.sh` on macOS. example-plugin, the three shapes, studio as data, the replay app and the dvui app on both backends all build. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of fizzyedit/fizzy#281. Pins fizzy at
main(189c7d5dac1b:fizzy.addDvuifrom fizzyedit/fizzy#326, app-framed windows from fizzyedit/fizzy#338, and the overlapping-window press fix from fizzyedit/fizzy#341) and the replay app's SDK at 0.2.20. That makes it supersede #3.zig build run-dvuiis a plain dvui app on fizzy's backend: dvui's own widgets and dvui's demo, nothing of fizzy the editor. Each floating window is an OS window of its own, and looks as it does inside the main window: dvui's header and close X, no OS title bar or minimise and zoom buttons (viewports.Frame.app). The OS moves a window by its header; the floating window resizes itself from its edges, as dvui's does anywhere, and its window follows. That's the demonstration the upstream dvui proposals (drawRetained,screensSet) point to.How it works (
dvui/main.zig, about 250 lines). Any floating window can go out, by its dvui id: the app's own, or dvui's demo (found by its tag's rect, since dvui gives a floating window's tag to the box inside it). dvui keeps where each is in its data (_rect), and the app moves that into the window's band and reads it back. There is onedvui.Windowand one frame.viewports.open);osPlaced);dvui.screensSet), so dvui keeps the floating window in it.Window.drawRetainedruns;viewports.place), told its header is where the OS drags it from (hints), and handed its picture: the subwindows in its band, taken out of the frame (viewports.Picture).-Ddvui-backend=sdl3builds the same code on dvui's own SDL3 backend, which has no viewports (viewports_none). The floating windows then stay in the main window, as in any dvui app.Floating windows only for now. Menus and dialogs as windows of their own need the app to say which subwindows are menus, and that comes later.
Verification, macOS
main:zig build dvui,dvui -Ddvui-backend=sdl3, all three shapes,studio -Dzon-layout=trueandreplay.main:dvuion both backends, all three shapes,studio -Dzon-layout=trueandreplay.🤖 Generated with Claude Code