Skip to main content

WindowManager

Struct WindowManager 

Source
pub struct WindowManager<R: Renderer> { /* private fields */ }
Expand description

Owns all windows. The OS adapter calls methods on this.

Generic over R: Renderer — the renderer creates per-window GPU surfaces from raw window handles. The OS adapter provides the handles, the renderer creates the surfaces, and this manager owns the pipelines.

Implementations§

Source§

impl<R: Renderer> WindowManager<R>

Source

pub fn new(renderer: R) -> Self

Source

pub fn create_window<W, F>( &mut self, window_handle: &W, config: WindowCreateConfig, view_init: F, ) -> Result<(), CreateWindowError>

Create a window: create GPU surface from handle, spawn view + render threads.

The OS adapter creates the OS window and passes the raw handle here. This manager uses the renderer to create the surface, then spawns the pipeline (render + view threads). The OS adapter keeps the window handle alive until after close_window returns.

Source

pub fn close_window(&mut self, id: WindowId)

Source

pub fn has_windows(&self) -> bool

Source

pub fn shutdown_all(&mut self)

Source

pub fn scale_factor(&self, id: WindowId) -> Option<f64>

Scale factor for a window — used by the OS adapter for pixel delta conversion.

Source

pub fn on_resize(&mut self, id: WindowId, width: u32, height: u32)

Source

pub fn on_scale_factor_changed( &mut self, id: WindowId, scale_factor: f64, refresh_rate_millihertz: Option<u32>, )

Source

pub fn on_focus_changed(&mut self, id: WindowId, focused: bool)

Source

pub fn on_redraw(&self, id: WindowId)

Trigger a repaint — sends Paint to the view thread.

Source

pub fn on_cursor_moved( &mut self, id: WindowId, physical_x: f64, physical_y: f64, )

Source

pub fn on_cursor_entered(&mut self, id: WindowId)

Source

pub fn on_cursor_left(&mut self, id: WindowId)

Source

pub fn on_mouse_input( &mut self, id: WindowId, button: MouseButton, btn_state: ButtonState, )

Source

pub fn on_mouse_wheel(&mut self, id: WindowId, delta: WheelDelta)

Source

pub fn on_keyboard_input( &mut self, id: WindowId, key: KeyCode, key_state: ButtonState, text: Option<String>, repeat: bool, )

Source

pub fn on_modifiers_changed( &mut self, id: WindowId, shift: bool, ctrl: bool, alt: bool, meta: bool, )

Auto Trait Implementations§

§

impl<R> Freeze for WindowManager<R>
where R: Freeze,

§

impl<R> !RefUnwindSafe for WindowManager<R>

§

impl<R> Send for WindowManager<R>

§

impl<R> Sync for WindowManager<R>

§

impl<R> Unpin for WindowManager<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for WindowManager<R>
where R: UnsafeUnpin,

§

impl<R> !UnwindSafe for WindowManager<R>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,