Window

Struct Window 

Source
pub struct Window {
Show 17 fields gui: RefCell<Gui>, screen_size: Size2D<u32, DeviceIndependentPixel>, monitor: MonitorHandle, webview_relative_mouse_point: Cell<Point2D<f32, DevicePixel>>, inner_size: Cell<PhysicalSize<u32>>, fullscreen: Cell<bool>, device_pixel_ratio_override: Option<f32>, xr_window_poses: RefCell<Vec<Rc<XRWindowPose>>>, modifiers_state: Cell<ModifiersState>, rendering_context: Rc<OffscreenRenderingContext>, window_rendering_context: Rc<WindowRenderingContext>, touch_event_simulator: Option<TouchEventSimulator>, pending_keyboard_events: RefCell<HashMap<InputEventId, KeyboardEvent>>, winit_window: Window, last_title: RefCell<String>, dialogs: RefCell<HashMap<WebViewId, Vec<Dialog>>>, visible_input_methods: RefCell<Vec<EmbedderControlId>>,
}

Fields§

§gui: RefCell<Gui>

The egui interface that is responsible for showing the user interface elements of this headed Window.

§screen_size: Size2D<u32, DeviceIndependentPixel>§monitor: MonitorHandle§webview_relative_mouse_point: Cell<Point2D<f32, DevicePixel>>§inner_size: Cell<PhysicalSize<u32>>

The inner size of the window in physical pixels which excludes OS decorations. It equals viewport size + (0, toolbar height).

§fullscreen: Cell<bool>§device_pixel_ratio_override: Option<f32>§xr_window_poses: RefCell<Vec<Rc<XRWindowPose>>>§modifiers_state: Cell<ModifiersState>§rendering_context: Rc<OffscreenRenderingContext>

The RenderingContext of Servo itself. This is used to render Servo results temporarily until they can be blitted into the egui scene.

§window_rendering_context: Rc<WindowRenderingContext>

The RenderingContext that renders directly onto the Window. This is used as the target of egui rendering and also where Servo rendering results are finally blitted.

§touch_event_simulator: Option<TouchEventSimulator>

A helper that simulates touch events when the --simulate-touch-events flag is enabled.

§pending_keyboard_events: RefCell<HashMap<InputEventId, KeyboardEvent>>

Keyboard events that have been sent to Servo that have still not been handled yet. When these are handled, they will optionally be used to trigger keybindings that are overridable by web content.

§winit_window: Window§last_title: RefCell<String>

The last title set on this window. We need to store this value here, as winit::Window::title is not supported very many platforms.

§dialogs: RefCell<HashMap<WebViewId, Vec<Dialog>>>

The current set of open dialogs.

§visible_input_methods: RefCell<Vec<EmbedderControlId>>

A list of showing [InputMethod] interfaces.

Implementations§

Source§

impl Window

Source

pub(crate) fn new( servoshell_preferences: &ServoShellPreferences, event_loop: &ActiveEventLoop, event_loop_proxy: EventLoopProxy<AppEvent>, initial_url: Url, ) -> Rc<Self>

Source

pub(crate) fn winit_window(&self) -> &Window

Source

fn handle_keyboard_input( &self, state: Rc<RunningAppState>, window: &ServoShellWindow, winit_event: KeyEvent, )

Source

fn handle_mouse_button_event( &self, webview: &WebView, button: MouseButton, action: ElementState, )

Helper function to handle a click

Source

fn handle_mouse_move_event( &self, webview: &WebView, position: PhysicalPosition<f64>, )

Helper function to handle mouse move events.

Source

fn handle_intercepted_key_bindings( &self, state: Rc<RunningAppState>, window: &ServoShellWindow, key_event: &KeyboardEvent, ) -> bool

Handle key events before sending them to Servo.

Source

fn force_srgb_color_space(window_handle: RawWindowHandle)

Source

fn show_ime(&self, input_method: InputMethodControl)

Source

pub(crate) fn for_each_active_dialog( &self, window: &ServoShellWindow, callback: impl Fn(&mut Dialog) -> bool, )

Source

fn add_dialog(&self, webview_id: WebViewId, dialog: Dialog)

Source

fn remove_dialog( &self, webview_id: WebViewId, embedder_control_id: EmbedderControlId, )

Source

fn has_active_dialog_for_webview(&self, webview_id: WebViewId) -> bool

Source

fn toolbar_height(&self) -> Length<f32, DeviceIndependentPixel>

Trait Implementations§

Source§

impl PlatformWindow for Window

Source§

fn notify_input_event_handled( &self, webview: &WebView, id: InputEventId, result: InputEventResult, )

Handle servoshell key bindings that may have been prevented by the page in the active webview.

Source§

fn screen_geometry(&self) -> ScreenGeometry

Source§

fn device_hidpi_scale_factor( &self, ) -> Scale<f32, DeviceIndependentPixel, DevicePixel>

Source§

fn hidpi_scale_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel>

Source§

fn rebuild_user_interface( &self, state: &RunningAppState, window: &ServoShellWindow, )

Request that the Window rebuild its user interface, if it has one. This should not repaint, but should prepare the user interface for painting when it is actually requested.
Source§

fn update_user_interface_state( &self, _: &RunningAppState, window: &ServoShellWindow, ) -> bool

Inform the Window that the state of a WebView has changed and that it should do an incremental update of user interface state. Returns true if the user interface actually changed and a rebuild and repaint is needed, false otherwise.
Source§

fn handle_winit_window_event( &self, state: Rc<RunningAppState>, window: &ServoShellWindow, event: WindowEvent, )

Handle a winit [WindowEvent]. Returns true if the event loop should continue and false otherwise. Read more
Source§

fn handle_winit_app_event(&self, app_event: AppEvent)

Handle a winit [AppEvent]. Returns true if the event loop should continue and false otherwise. Read more
Source§

fn request_repaint(&self, window: &ServoShellWindow)

Request that the window redraw itself. It is up to the window to do this once the windowing system is ready. If this is a headless window, the redraw will happen immediately.
Source§

fn request_resize( &self, _: &WebView, new_outer_size: DeviceIntSize, ) -> Option<DeviceIntSize>

Request a new outer size for the window, including external decorations. This should be the same as window.outerWidth and `window.outerHeight``
Source§

fn window_rect(&self) -> DeviceIndependentIntRect

Source§

fn set_position(&self, point: DeviceIntPoint)

Source§

fn set_fullscreen(&self, state: bool)

Source§

fn get_fullscreen(&self) -> bool

Source§

fn set_cursor(&self, cursor: Cursor)

Source§

fn id(&self) -> ServoShellWindowId

Source§

fn new_glwindow(&self, event_loop: &ActiveEventLoop) -> Rc<dyn GlWindow>

Source§

fn rendering_context(&self) -> Rc<dyn RenderingContext>

This returns RenderingContext matching the viewport.
Source§

fn theme(&self) -> Theme

Source§

fn maximize(&self, _webview: &WebView)

Source§

fn focused(&self) -> bool

Source§

fn show_embedder_control( &self, webview_id: WebViewId, embedder_control: EmbedderControl, )

Source§

fn hide_embedder_control( &self, webview_id: WebViewId, embedder_control_id: EmbedderControlId, )

Source§

fn show_bluetooth_device_dialog( &self, webview_id: WebViewId, devices: Vec<String>, response_sender: GenericSender<Option<String>>, )

Source§

fn show_permission_dialog( &self, webview_id: WebViewId, permission_request: PermissionRequest, )

Source§

fn show_http_authentication_dialog( &self, webview_id: WebViewId, authentication_request: AuthenticationRequest, )

Source§

fn dismiss_embedder_controls_for_webview(&self, webview_id: WebViewId)

Source§

fn take_user_interface_commands(&self) -> Vec<UserInterfaceCommand>

Source§

fn notify_media_session_event(&self, _: MediaSessionEvent)

Source§

fn notify_crashed( &self, _: WebView, _reason: String, _backtrace: Option<String>, )

Auto Trait Implementations§

§

impl !Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

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

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

Source§

fn downcast(&self) -> &T

Source§

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

Source§

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

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

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

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

impl<T> Filterable for T

Source§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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

Source§

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

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

Source§

impl<T> MaybeSendSync for T