Summary
The CLAP and VST3 wrappers ship with editor resizing stubbed out
(// TODO: Implement Host->Plugin GUI resizing). Because can_resize /
canResize return false, hosts treat every editor as fixed-size:
request_resize() has no effect and the editor only adopts a new size on a full
close and reopen.
This PR implements Host->Plugin resizing across the trait and both wrappers,
without breaking any existing adapter.
Changes
-
nice-plug-core: add Editor::set_size(width, height) -> bool, defaulting
to a no-op that returns false. This is the counterpart to Editor::size():
the wrapper calls it when the host resizes the view, and the editor resizes its
window/contents to the given logical dimensions. Editors that don't support
resizing inherit the default and behave exactly as before.
-
CLAP wrapper (crates/nice-plug/src/wrapper/clap/wrapper.rs):
ext_gui_can_resize -> true
ext_gui_get_resize_hints -> fills clap_gui_resize_hints
(can_resize_horizontally/vertically = true, no aspect-ratio lock)
ext_gui_adjust_size -> accepts the proposed size as-is
ext_gui_set_size -> converts physical -> logical via the editor scaling
factor and calls Editor::set_size
-
VST3 wrapper (crates/nice-plug/src/wrapper/vst3/view.rs):
canResize -> kResultOk
onSize -> converts the ViewRect to logical px and calls
Editor::set_size
Compatibility
set_size has a default implementation, so this is a non-breaking, additive
change. Editors that don't opt in keep returning false, and the host's resize
is rejected (the previous fixed-size behavior). Adapters that want resizing just
implement set_size.
Notes / follow-ups
request_resize() (CLAP context, VST3 request_resize) was already correct;
it simply had no effect while can_resize/canResize returned false.
- Verified on Windows (CLAP + VST3) with a webview-based editor that resizes its
window live from a UI drag handle. macOS/Linux resize paths follow the same
trait call but haven't been exercised here; the VST3 Linux IRunLoop plumbing
already in setFrame should cover the run-loop requirement.
### Summary
The CLAP and VST3 wrappers ship with editor resizing stubbed out
(`// TODO: Implement Host->Plugin GUI resizing`). Because `can_resize` /
`canResize` return false, hosts treat every editor as fixed-size:
`request_resize()` has no effect and the editor only adopts a new size on a full
close and reopen.
This PR implements Host->Plugin resizing across the trait and both wrappers,
without breaking any existing adapter.
### Changes
- **nice-plug-core**: add `Editor::set_size(width, height) -> bool`, defaulting
to a no-op that returns `false`. This is the counterpart to `Editor::size()`:
the wrapper calls it when the host resizes the view, and the editor resizes its
window/contents to the given *logical* dimensions. Editors that don't support
resizing inherit the default and behave exactly as before.
- **CLAP wrapper** (`crates/nice-plug/src/wrapper/clap/wrapper.rs`):
- `ext_gui_can_resize` -> `true`
- `ext_gui_get_resize_hints` -> fills `clap_gui_resize_hints`
(`can_resize_horizontally`/`vertically = true`, no aspect-ratio lock)
- `ext_gui_adjust_size` -> accepts the proposed size as-is
- `ext_gui_set_size` -> converts physical -> logical via the editor scaling
factor and calls `Editor::set_size`
- **VST3 wrapper** (`crates/nice-plug/src/wrapper/vst3/view.rs`):
- `canResize` -> `kResultOk`
- `onSize` -> converts the `ViewRect` to logical px and calls
`Editor::set_size`
### Compatibility
`set_size` has a default implementation, so this is a non-breaking, additive
change. Editors that don't opt in keep returning `false`, and the host's resize
is rejected (the previous fixed-size behavior). Adapters that want resizing just
implement `set_size`.
### Notes / follow-ups
- `request_resize()` (CLAP context, VST3 `request_resize`) was already correct;
it simply had no effect while `can_resize`/`canResize` returned false.
- Verified on Windows (CLAP + VST3) with a webview-based editor that resizes its
window live from a UI drag handle. macOS/Linux resize paths follow the same
trait call but haven't been exercised here; the VST3 Linux `IRunLoop` plumbing
already in `setFrame` should cover the run-loop requirement.