Skip to content

fix(egui): let synchronous hosts read the pending resize - #7

Open
unohee wants to merge 1 commit into
masterfrom
fix/egui-resize-request-order
Open

unohee wants to merge 1 commit into
masterfrom
fix/egui-resize-request-order

Conversation

@unohee

@unohee unohee commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

AUD-1611 follow-up to the enzyme resize work (enzyme PR robbert-vdh#30/robbert-vdh#31).

The frame flow in nih_plug_egui consumed requested_size with swap(None) before calling context.request_resize(). Synchronous hosts read Editor::size() inside that call, so:

  • standalone (GuiTask::Resize) and CLAP (host_gui->request_resize) received the previous size — the egui surface scaled immediately while the OS window resized one interaction behind (macOS standalone: skin shrinks, window stays; growing shrinks the window).
  • VST3 was unaffected: IPlugFrame::resizeView is posted as a task and reads the size after size.store().
  • AUv2 unaffected: no resize API, request dropped.

Fix: peek requested_size, call the host while the pending value is still observable, consume after; drop the request when the host refuses instead of retrying every frame.

Verified by instrumentation on the enzyme macOS standalone: with the fix, each queued GuiTask::Resize carries the requested size (previously the stored one).

The frame flow consumed requested_size with swap(None) *before* calling
context.request_resize(). Synchronous hosts read Editor::size() inside
that call, so standalone (GuiTask::Resize) and CLAP
(host_gui->request_resize) received the *previous* size: the egui surface
scaled immediately while the OS window was resized one interaction
behind — the reported macOS standalone symptom (skin shrinks, window
stays; growing shrinks the window).

Peek requested_size first, call the host while the pending value is
still observable, and only then consume it. Hosts that read
asynchronously (VST3 IPlugFrame via a posted task) are unaffected —
they already read after size.store(). When the host refuses (AUv2 has
no resize API) the request is dropped as before instead of retrying
every frame.

Verified by instrumentation on the macOS standalone: with the fix, each
queued GuiTask::Resize carries the requested size (previously it carried
the stored one).
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