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
impl Window
pub(crate) fn new( servoshell_preferences: &ServoShellPreferences, event_loop: &ActiveEventLoop, event_loop_proxy: EventLoopProxy<AppEvent>, initial_url: Url, ) -> Rc<Self>
pub(crate) fn winit_window(&self) -> &Window
fn handle_keyboard_input( &self, state: Rc<RunningAppState>, window: &ServoShellWindow, winit_event: KeyEvent, )
Helper function to handle a click
Sourcefn handle_mouse_move_event(
&self,
webview: &WebView,
position: PhysicalPosition<f64>,
)
fn handle_mouse_move_event( &self, webview: &WebView, position: PhysicalPosition<f64>, )
Helper function to handle mouse move events.
Sourcefn handle_intercepted_key_bindings(
&self,
state: Rc<RunningAppState>,
window: &ServoShellWindow,
key_event: &KeyboardEvent,
) -> bool
fn handle_intercepted_key_bindings( &self, state: Rc<RunningAppState>, window: &ServoShellWindow, key_event: &KeyboardEvent, ) -> bool
Handle key events before sending them to Servo.
fn force_srgb_color_space(window_handle: RawWindowHandle)
fn show_ime(&self, input_method: InputMethodControl)
pub(crate) fn for_each_active_dialog( &self, window: &ServoShellWindow, callback: impl Fn(&mut Dialog) -> bool, )
fn add_dialog(&self, webview_id: WebViewId, dialog: Dialog)
fn remove_dialog( &self, webview_id: WebViewId, embedder_control_id: EmbedderControlId, )
fn has_active_dialog_for_webview(&self, webview_id: WebViewId) -> bool
fn toolbar_height(&self) -> Length<f32, DeviceIndependentPixel>
Trait Implementations§
Source§impl PlatformWindow for Window
impl PlatformWindow for Window
Source§fn notify_input_event_handled(
&self,
webview: &WebView,
id: InputEventId,
result: InputEventResult,
)
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.
fn screen_geometry(&self) -> ScreenGeometry
fn device_hidpi_scale_factor( &self, ) -> Scale<f32, DeviceIndependentPixel, DevicePixel>
fn hidpi_scale_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel>
Source§fn rebuild_user_interface(
&self,
state: &RunningAppState,
window: &ServoShellWindow,
)
fn rebuild_user_interface( &self, state: &RunningAppState, window: &ServoShellWindow, )
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
fn update_user_interface_state( &self, _: &RunningAppState, window: &ServoShellWindow, ) -> bool
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,
)
fn handle_winit_window_event( &self, state: Rc<RunningAppState>, window: &ServoShellWindow, event: WindowEvent, )
WindowEvent]. Returns true if the event loop should continue
and false otherwise. Read moreSource§fn handle_winit_app_event(&self, app_event: AppEvent)
fn handle_winit_app_event(&self, app_event: AppEvent)
AppEvent]. Returns true if the event loop should continue and
false otherwise. Read moreSource§fn request_repaint(&self, window: &ServoShellWindow)
fn request_repaint(&self, window: &ServoShellWindow)
Source§fn request_resize(
&self,
_: &WebView,
new_outer_size: DeviceIntSize,
) -> Option<DeviceIntSize>
fn request_resize( &self, _: &WebView, new_outer_size: DeviceIntSize, ) -> Option<DeviceIntSize>
window.outerWidth and `window.outerHeight``fn window_rect(&self) -> DeviceIndependentIntRect
fn set_position(&self, point: DeviceIntPoint)
fn set_fullscreen(&self, state: bool)
fn get_fullscreen(&self) -> bool
fn set_cursor(&self, cursor: Cursor)
fn id(&self) -> ServoShellWindowId
fn new_glwindow(&self, event_loop: &ActiveEventLoop) -> Rc<dyn GlWindow>
Source§fn rendering_context(&self) -> Rc<dyn RenderingContext>
fn rendering_context(&self) -> Rc<dyn RenderingContext>
RenderingContext matching the viewport.fn theme(&self) -> Theme
fn maximize(&self, _webview: &WebView)
fn focused(&self) -> bool
fn show_embedder_control( &self, webview_id: WebViewId, embedder_control: EmbedderControl, )
fn hide_embedder_control( &self, webview_id: WebViewId, embedder_control_id: EmbedderControlId, )
fn show_bluetooth_device_dialog( &self, webview_id: WebViewId, devices: Vec<String>, response_sender: GenericSender<Option<String>>, )
fn show_permission_dialog( &self, webview_id: WebViewId, permission_request: PermissionRequest, )
fn show_http_authentication_dialog( &self, webview_id: WebViewId, authentication_request: AuthenticationRequest, )
fn dismiss_embedder_controls_for_webview(&self, webview_id: WebViewId)
fn take_user_interface_commands(&self) -> Vec<UserInterfaceCommand>
fn notify_media_session_event(&self, _: MediaSessionEvent)
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> 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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