Struct verso::compositor::IOCompositor

source ·
pub struct IOCompositor {
    pub current_window: WindowId,
    pub shutdown_state: ShutdownState,
    pub constellation_chan: Sender<ConstellationMsg>,
    pub webrender_api: RenderApi,
    pub rendering_context: RenderingContext,
    pub webxr_main_thread: MainThreadRegistry<()>,
    pub is_animating: bool,
    /* private fields */
}
Expand description

The Verso compositor contains a GL rendering context with a WebRender instance. The compositor will communicate with Servo using messages from the Constellation, then composite the WebRender frames and present the surface to the window.

Fields§

§current_window: WindowId

The current window that Compositor is handling.

§shutdown_state: ShutdownState

Tracks whether we are in the process of shutting down, or have shut down and should close the compositor.

§constellation_chan: Sender<ConstellationMsg>

The channel on which messages can be sent to the constellation.

§webrender_api: RenderApi

The webrender interface, if enabled.

§rendering_context: RenderingContext

The glutin instance that webrender targets

§webxr_main_thread: MainThreadRegistry<()>

Some XR devices want to run on the main thread.

§is_animating: bool

Whether the application is currently animating. Typically, when animations are active, the window will want to avoid blocking on UI events, and just run the event loop at the vsync interval.

Implementations§

source§

impl IOCompositor

source

pub fn new( current_window: WindowId, viewport: DeviceIntSize, scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>, state: InitialCompositorState, exit_after_load: bool, convert_mouse_to_touch: bool, ) -> Self

Create a new compositor.

source

pub fn deinit(self)

Consume compositor itself and deinit webrender.

source

pub fn maybe_start_shutting_down(&mut self)

Tell compositor to start shutting down.

source

pub fn send_root_pipeline_display_list(&mut self, window: &Window)

Set the root pipeline for our WebRender scene to a display list that consists of an iframe for each visible top-level browsing context, applying a transformation on the root for pinch zoom, page zoom, and HiDPI scaling.

source

pub fn on_resize_webview_event( &mut self, webview_id: TopLevelBrowsingContextId, rect: DeviceIntRect, )

Notify compositor the provided webview is resized. The compositor will tell constellation and update the display list.

source

pub fn swap_current_window(&mut self, window: &mut Window)

Change the current window of the compositor should display.

source

pub fn resize( &mut self, size: Size2D<i32, DevicePixel>, window: &mut Window, ) -> bool

Resize the rendering context and all web views. Return true if the compositor should repaint and present after this.

source

pub fn on_resize_window_event( &mut self, new_viewport: DeviceIntSize, window: &Window, ) -> bool

Handle the window resize event and return a boolean to tell embedder if it should further handle the resize event.

source

pub fn on_scale_factor_event( &mut self, scale_factor: f32, window: &Window, ) -> bool

Handle the window scale factor event and return a boolean to tell embedder if it should further handle the scale factor event.

source

pub fn on_mouse_window_event_class( &mut self, mouse_window_event: MouseWindowEvent, )

Handle the mouse event in the window.

source

pub fn on_mouse_window_move_event_class(&mut self, cursor: DevicePoint)

Handle mouse move event in the window.

source

pub fn on_touch_event( &mut self, event_type: TouchEventType, identifier: TouchId, location: DevicePoint, )

Handle touch event.

source

pub fn on_wheel_event(&mut self, delta: WheelDelta, p: DevicePoint)

Hit test and forward the wheel event to constellation.

source

pub fn on_scroll_event( &mut self, scroll_location: ScrollLocation, cursor: DeviceIntPoint, phase: TouchEventType, )

Handle scroll event.

source

pub fn on_zoom_reset_window_event(&mut self, window: &Window)

Handle zoom reset event

source

pub fn on_zoom_window_event(&mut self, magnification: f32, window: &Window)

Handle zoom event in the window

source

pub fn on_pinch_zoom_window_event(&mut self, magnification: f32)

Simulate a pinch zoom

source

pub fn composite(&mut self, window: &Window)

Composite to the given target if any, or the current target otherwise.

source

pub fn receive_messages( &mut self, windows: &mut HashMap<WindowId, Window>, ) -> bool

Receive and handle compositor messages.

source

pub fn perform_updates( &mut self, windows: &mut HashMap<WindowId, Window>, ) -> bool

Perform composition and related actions.

source

pub fn repaint_synchronously(&mut self, windows: &mut HashMap<WindowId, Window>)

Repaints and recomposites synchronously. You must be careful when calling this, as if a paint is not scheduled the compositor will hang forever.

This is used when resizing the window.

source

pub fn toggle_webrender_debug(&mut self, option: WebRenderDebugOption)

Update debug option of the webrender.

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Filterable for T

§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

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

§

fn maybe_boxed(self) -> Box<T>

Convert
§

impl<T> MaybeBoxed<T> for T

§

fn maybe_boxed(self) -> T

Convert
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

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

§

impl<T> MaybeSendSync for T