Skip to main content

WindowPositioner

Trait WindowPositioner 

Source
pub trait WindowPositioner: Send + Sync {
    // Required method
    fn compute_position<'life0, 'async_trait>(
        &'life0 self,
        request: PositionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<WindowPosition, HostApiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Calculates the optimal window position from configuration and platform state.

Three-tier priority (mutually exclusive, first match wins):

  1. enable_drag_window + valid saved_position → use saved position
  2. follow_mouse → center on the monitor containing the cursor
  3. Neither → center on the primary monitor

Required Methods§

Source

fn compute_position<'life0, 'async_trait>( &'life0 self, request: PositionRequest, ) -> Pin<Box<dyn Future<Output = Result<WindowPosition, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Compute the optimal window position. Returns the position in physical pixels, or an error if unrecoverable.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§