WindowInternal

Struct WindowInternal 

Source
pub struct WindowInternal {
    pub renderer_resources: RendererResources,
    pub renderer_type: Option<RendererType>,
    pub previous_window_state: Option<FullWindowState>,
    pub current_window_state: FullWindowState,
    pub document_id: DocumentId,
    pub id_namespace: IdNamespace,
    pub epoch: Epoch,
    pub layout_results: Vec<LayoutResult>,
    pub gl_texture_cache: GlTextureCache,
    pub scroll_states: ScrollStates,
    pub timers: BTreeMap<TimerId, Timer>,
    pub threads: BTreeMap<ThreadId, Thread>,
}

Fields§

§renderer_resources: RendererResources

Currently loaded fonts and images present in this renderer (window)

§renderer_type: Option<RendererType>

Renderer type: Hardware-with-software-fallback, pure software or pure hardware renderer?

§previous_window_state: Option<FullWindowState>

Windows state of the window of (current frame - 1): initialized to None on startup

§current_window_state: FullWindowState

Window state of this current window (current frame): initialized to the state of WindowCreateOptions

§document_id: DocumentId

A “document” in WebRender usually corresponds to one tab (i.e. in Azuls case, the whole window).

§id_namespace: IdNamespace

ID namespace under which every font / image for this window is registered

§epoch: Epoch

The “epoch” is a frame counter, to remove outdated images, fonts and OpenGL textures when they’re not in use anymore.

§layout_results: Vec<LayoutResult>

Currently active, layouted rectangles and styled DOMs

§gl_texture_cache: GlTextureCache

Currently GL textures inside the active CachedDisplayList

§scroll_states: ScrollStates

States of scrolling animations, updated every frame

§timers: BTreeMap<TimerId, Timer>

Timer ID -> Timer + Win32 pointer map (created using SetTimer)

§threads: BTreeMap<ThreadId, Thread>

List of threads running in the background

Implementations§

Source§

impl WindowInternal

Source§

impl WindowInternal

Source

pub fn new<F>( init: WindowInternalInit, data: &mut RefAny, image_cache: &ImageCache, gl_context: &OptionGlContextPtr, all_resource_updates: &mut Vec<ResourceUpdate>, callbacks: &RenderCallbacks, fc_cache_real: &mut FcFontCache, relayout_fn: RelayoutFn, hit_test_func: F, ) -> Self

Initializes the WindowInternal on window creation. Calls the layout() method once to initializes the layout

Source

pub fn regenerate_styled_dom<F>( &mut self, data: &mut RefAny, image_cache: &ImageCache, gl_context: &OptionGlContextPtr, all_resource_updates: &mut Vec<ResourceUpdate>, current_window_dpi: DpiScaleFactor, callbacks: &RenderCallbacks, fc_cache_real: &mut FcFontCache, relayout_fn: RelayoutFn, hit_test_func: F, )

Calls the layout function again and updates the self.internal.gl_texture_cache field

Source

pub fn get_current_scroll_states( &self, ) -> BTreeMap<DomId, BTreeMap<NodeHierarchyItemId, ScrollPosition>>

Returns a copy of the current scroll states + scroll positions

Source

pub fn get_content_size(&self) -> LogicalSize

Returns the overflowing size of the root body node. If WindowCreateOptions.size_to_content is set, the window size should be adjusted to this size before the window is shown.

Source

pub fn do_quick_resize( &mut self, image_cache: &ImageCache, callbacks: &RenderCallbacks, relayout_fn: RelayoutFn, fc_cache: &FcFontCache, gl_context: &OptionGlContextPtr, window_size: &WindowSize, window_theme: WindowTheme, ) -> QuickResizeResult

Does a full re-layout (without calling layout()) again: called in simple resize() scenarios

Source

pub fn may_have_changed_monitor(&self) -> bool

Returns whether the size or position of the window changed (if true, the caller needs to update the monitor field), since the window may have moved to a different monitor

Source

pub fn get_layout_size(&self) -> LayoutSize

Source

pub fn get_menu_bar<'a>(&'a self) -> Option<&'a Box<Menu>>

Returns the menu bar set on the LayoutResults[0] node 0 or None

Source

pub fn get_context_menu<'a>( &'a self, ) -> Option<(&'a Box<Menu>, HitTestItem, DomNodeId)>

Returns the current context menu on the nearest hit node or None if no context menu was found

Source

pub fn run_single_timer( &mut self, timer_id: usize, frame_start: Instant, current_window_handle: &RawWindowHandle, gl_context: &OptionGlContextPtr, image_cache: &mut ImageCache, system_fonts: &mut FcFontCache, system_callbacks: &ExternalSystemCallbacks, ) -> CallCallbacksResult

Runs a single timer, similar to CallbacksOfHitTest.call()

NOTE: The timer has to be selected first by the calling code and verified that it is ready to run

Source

pub fn run_all_threads( &mut self, data: &mut RefAny, current_window_handle: &RawWindowHandle, gl_context: &OptionGlContextPtr, image_cache: &mut ImageCache, system_fonts: &mut FcFontCache, system_callbacks: &ExternalSystemCallbacks, ) -> CallCallbacksResult

Source

pub fn invoke_single_callback( &mut self, callback: &mut Callback, data: &mut RefAny, current_window_handle: &RawWindowHandle, gl_context: &OptionGlContextPtr, image_cache: &mut ImageCache, system_fonts: &mut FcFontCache, system_callbacks: &ExternalSystemCallbacks, ) -> CallCallbacksResult

Source

pub fn invoke_menu_callback( &mut self, menu_callback: &mut MenuCallback, hit_dom_node: DomNodeId, current_window_handle: &RawWindowHandle, gl_context: &OptionGlContextPtr, image_cache: &mut ImageCache, system_fonts: &mut FcFontCache, system_callbacks: &ExternalSystemCallbacks, ) -> CallCallbacksResult

Trait Implementations§

Source§

impl Debug for WindowInternal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<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, 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.