Make size/position types generic over pixel type (#1277)

* Begin implementing DPI generics

* Fix multithreaded example

* Format

* Fix serde test

* hopefully fix most of the errors

* Fix dpi module errors

* More error fixings

* Format

* fix macos errors

* Another error pass

* Replace bad type signatures

* more fixins
This commit is contained in:
Osspial 2020-01-04 01:33:07 -05:00
parent b16042a047
commit 3a1e694c2f
40 changed files with 388 additions and 336 deletions

View file

@ -182,10 +182,10 @@ pub enum StartCause {
#[derive(Debug, PartialEq)]
pub enum WindowEvent<'a> {
/// The size of the window has changed. Contains the client area's new dimensions.
Resized(PhysicalSize),
Resized(PhysicalSize<u32>),
/// The position of the window has changed. Contains the window's new position.
Moved(PhysicalPosition),
Moved(PhysicalPosition<u32>),
/// The window has been requested to close.
CloseRequested,
@ -242,7 +242,7 @@ pub enum WindowEvent<'a> {
/// (x,y) coords in pixels relative to the top-left corner of the window. Because the range of this data is
/// limited by the display area and it may have been transformed by the OS to implement effects such as cursor
/// acceleration, it should not be used to implement non-cursor-like interactions such as 3D camera control.
position: PhysicalPosition,
position: PhysicalPosition<i32>,
#[deprecated = "Deprecated in favor of DeviceEvent::ModifiersChanged"]
modifiers: ModifiersState,
},
@ -308,7 +308,7 @@ pub enum WindowEvent<'a> {
/// For more information about DPI in general, see the [`dpi`](dpi/index.html) module.
HiDpiFactorChanged {
hidpi_factor: f64,
new_inner_size: &'a mut Option<PhysicalSize>,
new_inner_size: &'a mut Option<PhysicalSize<u32>>,
},
/// The system window theme has changed.
@ -534,7 +534,7 @@ pub enum TouchPhase {
pub struct Touch {
pub device_id: DeviceId,
pub phase: TouchPhase,
pub location: PhysicalPosition,
pub location: PhysicalPosition<f64>,
/// Describes how hard the screen was pressed. May be `None` if the platform
/// does not support pressure sensitivity.
///
@ -645,7 +645,7 @@ pub enum MouseScrollDelta {
/// Scroll events are expressed as a PixelDelta if
/// supported by the device (eg. a touchpad) and
/// platform.
PixelDelta(LogicalPosition),
PixelDelta(LogicalPosition<f64>),
}
/// Symbolic name for a keyboard key.