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
impl IOCompositor
sourcepub 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
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.
sourcepub fn maybe_start_shutting_down(&mut self)
pub fn maybe_start_shutting_down(&mut self)
Tell compositor to start shutting down.
sourcepub fn send_root_pipeline_display_list(&mut self, window: &Window)
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.
sourcepub fn on_resize_webview_event(
&mut self,
webview_id: TopLevelBrowsingContextId,
rect: DeviceIntRect,
)
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.
sourcepub fn swap_current_window(&mut self, window: &mut Window)
pub fn swap_current_window(&mut self, window: &mut Window)
Change the current window of the compositor should display.
sourcepub fn resize(
&mut self,
size: Size2D<i32, DevicePixel>,
window: &mut Window,
) -> bool
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.
sourcepub fn on_resize_window_event(
&mut self,
new_viewport: DeviceIntSize,
window: &Window,
) -> bool
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.
sourcepub fn on_scale_factor_event(
&mut self,
scale_factor: f32,
window: &Window,
) -> bool
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.
sourcepub fn on_mouse_window_event_class(
&mut self,
mouse_window_event: MouseWindowEvent,
)
pub fn on_mouse_window_event_class( &mut self, mouse_window_event: MouseWindowEvent, )
Handle the mouse event in the window.
sourcepub fn on_mouse_window_move_event_class(&mut self, cursor: DevicePoint)
pub fn on_mouse_window_move_event_class(&mut self, cursor: DevicePoint)
Handle mouse move event in the window.
sourcepub fn on_touch_event(
&mut self,
event_type: TouchEventType,
identifier: TouchId,
location: DevicePoint,
)
pub fn on_touch_event( &mut self, event_type: TouchEventType, identifier: TouchId, location: DevicePoint, )
Handle touch event.
sourcepub fn on_wheel_event(&mut self, delta: WheelDelta, p: DevicePoint)
pub fn on_wheel_event(&mut self, delta: WheelDelta, p: DevicePoint)
Hit test and forward the wheel event to constellation.
sourcepub fn on_scroll_event(
&mut self,
scroll_location: ScrollLocation,
cursor: DeviceIntPoint,
phase: TouchEventType,
)
pub fn on_scroll_event( &mut self, scroll_location: ScrollLocation, cursor: DeviceIntPoint, phase: TouchEventType, )
Handle scroll event.
sourcepub fn on_zoom_reset_window_event(&mut self, window: &Window)
pub fn on_zoom_reset_window_event(&mut self, window: &Window)
Handle zoom reset event
sourcepub fn on_zoom_window_event(&mut self, magnification: f32, window: &Window)
pub fn on_zoom_window_event(&mut self, magnification: f32, window: &Window)
Handle zoom event in the window
sourcepub fn on_pinch_zoom_window_event(&mut self, magnification: f32)
pub fn on_pinch_zoom_window_event(&mut self, magnification: f32)
Simulate a pinch zoom
sourcepub fn composite(&mut self, window: &Window)
pub fn composite(&mut self, window: &Window)
Composite to the given target if any, or the current target otherwise.
sourcepub fn receive_messages(
&mut self,
windows: &mut HashMap<WindowId, Window>,
) -> bool
pub fn receive_messages( &mut self, windows: &mut HashMap<WindowId, Window>, ) -> bool
Receive and handle compositor messages.
sourcepub fn perform_updates(
&mut self,
windows: &mut HashMap<WindowId, Window>,
) -> bool
pub fn perform_updates( &mut self, windows: &mut HashMap<WindowId, Window>, ) -> bool
Perform composition and related actions.
sourcepub fn repaint_synchronously(&mut self, windows: &mut HashMap<WindowId, Window>)
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.
sourcepub fn toggle_webrender_debug(&mut self, option: WebRenderDebugOption)
pub fn toggle_webrender_debug(&mut self, option: WebRenderDebugOption)
Update debug option of the webrender.
Auto Trait Implementations§
impl !Freeze for IOCompositor
impl !RefUnwindSafe for IOCompositor
impl !Send for IOCompositor
impl !Sync for IOCompositor
impl Unpin for IOCompositor
impl !UnwindSafe for IOCompositor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> Filterable for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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