mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
alias some euclid types
This commit is contained in:
parent
ac4614d6ce
commit
e25dd45139
11 changed files with 73 additions and 69 deletions
|
@ -5,25 +5,25 @@
|
|||
//! Abstract windowing methods. The concrete implementations of these can be found in `platform/`.
|
||||
|
||||
use compositor_thread::EventLoopWaker;
|
||||
use euclid::{Length, TypedScale, TypedPoint2D, TypedSize2D};
|
||||
use euclid::TypedScale;
|
||||
use gleam::gl;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TopLevelBrowsingContextId, TraversalDirection};
|
||||
use net_traits::net_error_list::NetError;
|
||||
use script_traits::{LoadData, MouseButton, TouchEventType, TouchId};
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use servo_geometry::{DeviceIndependentPixel, DeviceUintLength};
|
||||
use servo_url::ServoUrl;
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
use std::rc::Rc;
|
||||
use style_traits::DevicePixel;
|
||||
use style_traits::cursor::CursorKind;
|
||||
use webrender_api::{DeviceUintSize, DeviceUintRect, ScrollLocation};
|
||||
use webrender_api::{DeviceIntPoint, DeviceSize, DevicePoint, DeviceUintSize, DeviceUintRect, ScrollLocation};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum MouseWindowEvent {
|
||||
Click(MouseButton, TypedPoint2D<f32, DevicePixel>),
|
||||
MouseDown(MouseButton, TypedPoint2D<f32, DevicePixel>),
|
||||
MouseUp(MouseButton, TypedPoint2D<f32, DevicePixel>),
|
||||
Click(MouseButton, DevicePoint),
|
||||
MouseDown(MouseButton, DevicePoint),
|
||||
MouseUp(MouseButton, DevicePoint),
|
||||
}
|
||||
|
||||
/// Various debug and profiling flags that WebRender supports.
|
||||
|
@ -54,12 +54,12 @@ pub enum WindowEvent {
|
|||
/// Sent when a mouse hit test is to be performed.
|
||||
MouseWindowEventClass(MouseWindowEvent),
|
||||
/// Sent when a mouse move.
|
||||
MouseWindowMoveEventClass(TypedPoint2D<f32, DevicePixel>),
|
||||
MouseWindowMoveEventClass(DevicePoint),
|
||||
/// Touch event: type, identifier, point
|
||||
Touch(TouchEventType, TouchId, TypedPoint2D<f32, DevicePixel>),
|
||||
Touch(TouchEventType, TouchId, DevicePoint),
|
||||
/// Sent when the user scrolls. The first point is the delta and the second point is the
|
||||
/// origin.
|
||||
Scroll(ScrollLocation, TypedPoint2D<i32, DevicePixel>, TouchEventType),
|
||||
Scroll(ScrollLocation, DeviceIntPoint, TouchEventType),
|
||||
/// Sent when the user zooms.
|
||||
Zoom(f32),
|
||||
/// Simulated "pinch zoom" gesture for non-touch platforms (e.g. ctrl-scrollwheel).
|
||||
|
@ -123,21 +123,20 @@ pub trait WindowMethods {
|
|||
/// Returns the position and size of the window within the rendering area.
|
||||
fn window_rect(&self) -> DeviceUintRect;
|
||||
/// Returns the size of the window.
|
||||
fn size(&self) -> TypedSize2D<f32, DevicePixel>;
|
||||
fn size(&self) -> DeviceSize;
|
||||
/// Presents the window to the screen (perhaps by page flipping).
|
||||
fn present(&self);
|
||||
|
||||
/// Return the size of the window with head and borders and position of the window values
|
||||
fn client_window(&self, ctx: TopLevelBrowsingContextId) ->
|
||||
(TypedSize2D<u32, DevicePixel>, TypedPoint2D<i32, DevicePixel>);
|
||||
fn client_window(&self, ctx: TopLevelBrowsingContextId) -> (DeviceUintSize, DeviceIntPoint);
|
||||
/// Return the size of the screen.
|
||||
fn screen_size(&self, ctx: TopLevelBrowsingContextId) -> TypedSize2D<u32, DevicePixel>;
|
||||
fn screen_size(&self, ctx: TopLevelBrowsingContextId) -> DeviceUintSize;
|
||||
/// Return the available size of the screen.
|
||||
fn screen_avail_size(&self, ctx: TopLevelBrowsingContextId) -> TypedSize2D<u32, DevicePixel>;
|
||||
fn screen_avail_size(&self, ctx: TopLevelBrowsingContextId) -> DeviceUintSize;
|
||||
/// Set the size inside of borders and head
|
||||
fn set_inner_size(&self, ctx: TopLevelBrowsingContextId, size: TypedSize2D<u32, DevicePixel>);
|
||||
fn set_inner_size(&self, ctx: TopLevelBrowsingContextId, size: DeviceUintSize);
|
||||
/// Set the window position
|
||||
fn set_position(&self, ctx: TopLevelBrowsingContextId, point: TypedPoint2D<i32, DevicePixel>);
|
||||
fn set_position(&self, ctx: TopLevelBrowsingContextId, point: DeviceIntPoint);
|
||||
/// Set fullscreen state
|
||||
fn set_fullscreen_state(&self, ctx: TopLevelBrowsingContextId, state: bool);
|
||||
|
||||
|
@ -167,7 +166,7 @@ pub trait WindowMethods {
|
|||
/// Requests that the window system prepare a composite. Typically this will involve making
|
||||
/// some type of platform-specific graphics context current. Returns true if the composite may
|
||||
/// proceed and false if it should not.
|
||||
fn prepare_for_composite(&self, width: Length<u32, DevicePixel>, height: Length<u32, DevicePixel>) -> bool;
|
||||
fn prepare_for_composite(&self, width: DeviceUintLength, height: DeviceUintLength) -> bool;
|
||||
|
||||
/// Sets the cursor to be used in the window.
|
||||
fn set_cursor(&self, cursor: CursorKind);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue