pub struct PluginWindow { /* private fields */ }Expand description
A plugin window that manages the native window and plugin editor lifecycle
Implementations§
Source§impl PluginWindow
impl PluginWindow
Sourcepub fn service_platform_events(&self) -> Result<()>
pub fn service_platform_events(&self) -> Result<()>
Pump the editor’s window-level traffic that has to cross into the plugin.
Call this from your UI event loop, once per frame, while the window is open. Two things depend on it:
- Plugin-initiated resizes. A resizable editor (VSTGUI zoom, a “big view” toggle)
asks the host to resize through
IPlugFrame::resizeView. This applies the request to the native window, so the editor is not clipped by a window that never grew. - Windows DPI changes.
WM_DPICHANGEDapplies its suggested native rectangle immediately in the window procedure and queues the new content scale for here; making the COM call outside the window procedure prevents reentrant deadlocks on the plugin mutex.
Deliberately non-blocking: if the plugin mutex is held elsewhere (the audio callback holds it per block) this returns without doing anything, and the pending work is picked up on the next call.
Self::is_open and Self::closed_by_user do not run this — they stay lock-free
so they are safe to call while holding the plugin lock.
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Check if the window is currently open.
Reports false once the user has dismissed the window themselves, even though the
handle is still around — see Self::closed_by_user.
Reads native window state only: it never takes the plugin lock, so it is safe to call
while holding it. Pair it with Self::service_platform_events, which does the work
that has to reach the plugin.
Sourcepub fn closed_by_user(&self) -> bool
pub fn closed_by_user(&self) -> bool
Whether the user closed the window themselves, through its title-bar close button.
Neither the plugin nor the host is told when that happens, so a host that tracks “the
editor is open” in its own UI should poll this each frame and drop or
close the window when it reports true. Otherwise the editor stays
attached to a window that is gone from the screen.
Cheap and lock-free in the same sense as Self::is_open: native window state only,
never the plugin lock.