Skip to main content

PluginWindow

Struct PluginWindow 

Source
pub struct PluginWindow { /* private fields */ }
Expand description

A plugin window that manages the native window and plugin editor lifecycle

Implementations§

Source§

impl PluginWindow

Source

pub fn new(plugin: Arc<Mutex<Plugin>>) -> Self

Create a new plugin window for the given plugin

Source

pub fn open(&mut self) -> Result<()>

Open the plugin window

Source

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_DPICHANGED applies 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.

Source

pub fn close(&mut self)

Close the plugin window

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for PluginWindow

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.