AUDIO
Source snapshot · 11 November 2026

Native embedded-editor prototype

Native backend contract

The C++ header retains local-file creation for existing consumers and adds ravet_web_create_html with copied buffer snapshots. Every call/callback belongs on the host UI thread (the Cocoa main thread on macOS). Windows/Linux bind their UI-thread check to the first successful creation; the caller must choose the correct thread. Local-file navigation stays under its asset root; inline HTML permits about:blank. Callback message JSON is bounded to 65,536 bytes; inline page input is bounded to 1 MiB. Consumers of the raw C++ API own pointer validity and callback lifetime. The Rust wrapper supplies those contracts for its owned view and context.

No exception crosses this C ABI. ravet_web_create, ravet_web_create_html and ravet_web_eval are noexcept, as are the backends' WebView2 handlers, window procedures and GLib callbacks, so an allocation failure inside them terminates the process (as a Rust allocation failure does) instead of unwinding into the caller. Cocoa calls made off the main thread return their failure value (null, false or no effect) rather than asserting. Page message bodies that JSON cannot encode, such as a Date, are dropped. A message or snapshot callback may destroy its own view. On Windows the WebView2Loader.dll loaded by the first editor stays loaded for the rest of the process. See decision 0292.

Opaque layer backing is configurable through finite clamped RGB values. The WebKit under-page colour requires macOS 12. A 50 ms timer delivers validated JSON objects/arrays through window.ravetUpdate. Identical strings are suppressed after successful delivery; changed snapshots coalesce while one JavaScript evaluation is in flight. Navigation clears the delivered snapshot. DOM updates also avoid rewriting unchanged properties. No callback deadline or native heap accounting is implied by this control-thread machinery.

Cocoa/WebKit and Linux/WebKitGTK disable browser context menus by default for both local-file and inline HTML editors, including child frames and reloads. A document-start listener cancels the contextmenu default action without stopping event propagation or cancelling mouse/pointer events. Controls can still implement right-click reset and custom menus; their contextmenu handlers receive an event with defaultPrevented already set. This also applies to standalone windows using the shared WebKit backend. There is currently no native option to restore the browser menu; Windows/WebView2 retains its existing policy. The hidden macOS context-menu probe checks synthetic DOM event cancellation, reset/custom-handler delivery, left-click preservation and child-frame/reload coverage for both creation paths; Linux runtime evidence for this policy is pending.

On macOS, editor web views accept the activating mouse press. A drag that begins in an inactive editor window reaches the page on that first press, without a separate click to focus it. The native AppKit first-mouse probe checks begin, change and end delivery while another owned window is key. Host-specific window routing still needs actual DAW validation. This probe briefly shows two owned windows and requires an interactive Cocoa desktop session.

Keyboard focus

Some hosts keep key status for their own shortcuts and do not make a plug-in window key when it is clicked; Pro Tools does this. On macOS the web view therefore watches which element has focus. When a text field (text-like <input>, <textarea> or contenteditable) gains focus, it makes its window key and itself first responder; when the field loses focus or is removed, it gives key status back to the window that had it, if it took it. If the window cannot become key, typing without the Command key is forwarded to the web view while the field has focus; Command-key shortcuts stay with the host, and a click in another window or switching applications blurs the field. Buttons, knobs and other controls never take key status. Where the window is already key, as in Logic and Live, nothing changes. Pages need no code for this. The ravet-web-keyboard-focus probe checks the three cases with real AppKit windows; it is not a DAW run. A host that consumes key events before AppKit event monitors run cannot be helped this way. See decision 0286.