diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md index a39018bde4c..005307c40d8 100644 --- a/src/changelog/unreleased.md +++ b/src/changelog/unreleased.md @@ -59,7 +59,7 @@ changelog entry. - Implement `Clone`, `Copy`, `Debug`, `Deserialize`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd` and `Serialize` on many types. - Add `MonitorHandle::current_video_mode()`. -- Add `PointerType`, `PointerSource`, `ButtonSource`, `FingerId` and `position` to all pointer +- Add `PointerKind`, `PointerSource`, `ButtonSource`, `FingerId` and `position` to all pointer events as part of the pointer event overhaul. ### Changed @@ -110,14 +110,14 @@ changelog entry. - Rename `MouseInput` to `PointerButton`. - Add `position` to every `PointerEvent`. - Remove `Touch`, which is folded into the `Pointer*` events. - - New `PointerType` added to `PointerEntered` and `PointerLeft`, signifying which pointer type is + - New `PointerKind` added to `PointerEntered` and `PointerLeft`, signifying which pointer type is the source of this event. - - New `PointerSource` added to `PointerMoved`, similar to `PointerType` but holding additional + - New `PointerSource` added to `PointerMoved`, similar to `PointerKind` but holding additional data. - - New `ButtonSource` added to `PointerButton`, similar to `PointerType` but holding pointer type + - New `ButtonSource` added to `PointerButton`, similar to `PointerKind` but holding pointer type specific buttons. Use `ButtonSource::mouse_button()` to easily normalize any pointer button type to a generic mouse button. - - New `FingerId` added to `PointerType::Touch` and `PointerSource::Touch` able to uniquely + - New `FingerId` added to `PointerKind::Touch` and `PointerSource::Touch` able to uniquely identify a finger in a multi-touch interaction. Replaces the old `Touch::id`. - On Web and Windows, add `FingerIdExt*::is_primary()`, exposing a way to determine the primary finger in a multi-touch interaction. @@ -148,7 +148,7 @@ changelog entry. - Remove `MonitorHandle::size()` and `refresh_rate_millihertz()` in favor of `MonitorHandle::current_video_mode()`. - On Android, remove all `MonitorHandle` support instead of emitting false data. -- Remove `WindowEvent::Touch` and `Touch` in favor of the new `PointerType`, `PointerSource` and +- Remove `WindowEvent::Touch` and `Touch` in favor of the new `PointerKind`, `PointerSource` and `ButtonSource` as part of the new pointer event overhaul. - Remove `Force::altitude_angle`. diff --git a/src/event.rs b/src/event.rs index 8f315f32e2e..a8941333b49 100644 --- a/src/event.rs +++ b/src/event.rs @@ -258,7 +258,7 @@ pub enum WindowEvent { /// [`transform`]: https://developer.mozilla.org/en-US/docs/Web/CSS/transform position: PhysicalPosition, - ty: PointerType, + kind: PointerKind, }, /// The cursor has left the window. @@ -278,7 +278,7 @@ pub enum WindowEvent { /// [`transform`]: https://developer.mozilla.org/en-US/docs/Web/CSS/transform position: Option>, - ty: PointerType, + kind: PointerKind, }, /// A mouse wheel movement or touchpad scroll occurred. @@ -456,7 +456,7 @@ pub enum WindowEvent { /// **Wayland/X11:** Can only identify [`Touch`](Self::Touch), any other pointer is identified as /// [`Mouse`](Self::Mouse). #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub enum PointerType { +pub enum PointerKind { Mouse, /// See [`PointerSource::Touch`] for more details. /// @@ -519,7 +519,7 @@ pub enum PointerSource { Unknown, } -impl From for PointerType { +impl From for PointerKind { fn from(source: PointerSource) -> Self { match source { PointerSource::Mouse => Self::Mouse, @@ -1141,7 +1141,7 @@ mod tests { use crate::event::Event::*; use crate::event::Ime::Enabled; use crate::event::WindowEvent::*; - use crate::event::{PointerSource, PointerType}; + use crate::event::{PointerKind, PointerSource}; use crate::window::WindowId; // Mainline events. @@ -1173,12 +1173,12 @@ mod tests { with_window_event(PointerEntered { device_id: did, position: (0, 0).into(), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }); with_window_event(PointerLeft { device_id: did, position: Some((0, 0).into()), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }); with_window_event(MouseWheel { device_id: did, diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 18efb546126..211a1a9eef6 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -358,7 +358,7 @@ impl EventLoop { let event = event::WindowEvent::PointerEntered { device_id, position, - ty: event::PointerType::Touch(finger_id), + kind: event::PointerKind::Touch(finger_id), }; app.window_event(&self.window_target, window_id, event); let event = event::WindowEvent::PointerButton { @@ -391,7 +391,7 @@ impl EventLoop { let event = event::WindowEvent::PointerLeft { device_id, position: Some(position), - ty: event::PointerType::Touch(finger_id), + kind: event::PointerKind::Touch(finger_id), }; app.window_event(&self.window_target, window_id, event); }, diff --git a/src/platform_impl/apple/appkit/view.rs b/src/platform_impl/apple/appkit/view.rs index 9276155cdbe..8db1f998415 100644 --- a/src/platform_impl/apple/appkit/view.rs +++ b/src/platform_impl/apple/appkit/view.rs @@ -27,8 +27,8 @@ use super::window::WinitWindow; use super::DEVICE_ID; use crate::dpi::{LogicalPosition, LogicalSize}; use crate::event::{ - DeviceEvent, ElementState, Ime, Modifiers, MouseButton, MouseScrollDelta, PointerSource, - PointerType, TouchPhase, WindowEvent, + DeviceEvent, ElementState, Ime, Modifiers, MouseButton, MouseScrollDelta, PointerKind, + PointerSource, TouchPhase, WindowEvent, }; use crate::keyboard::{Key, KeyCode, KeyLocation, ModifiersState, NamedKey}; use crate::platform::macos::OptionAsAlt; @@ -651,7 +651,7 @@ declare_class!( self.queue_event(WindowEvent::PointerEntered { device_id: DEVICE_ID, position: view_point.to_physical(self.scale_factor()), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }); } @@ -664,7 +664,7 @@ declare_class!( self.queue_event(WindowEvent::PointerLeft { device_id: DEVICE_ID, position: Some(position), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }); } diff --git a/src/platform_impl/apple/uikit/view.rs b/src/platform_impl/apple/uikit/view.rs index 525a7c45bd1..6d5e4415da9 100644 --- a/src/platform_impl/apple/uikit/view.rs +++ b/src/platform_impl/apple/uikit/view.rs @@ -17,7 +17,7 @@ use super::window::WinitUIWindow; use super::{FingerId, DEVICE_ID}; use crate::dpi::PhysicalPosition; use crate::event::{ - ButtonSource, ElementState, Event, FingerId as RootFingerId, Force, PointerSource, PointerType, + ButtonSource, ElementState, Event, FingerId as RootFingerId, Force, PointerKind, PointerSource, TouchPhase, WindowEvent, }; use crate::window::{WindowAttributes, WindowId as RootWindowId}; @@ -495,10 +495,10 @@ impl WinitView { event: WindowEvent::PointerEntered { device_id: DEVICE_ID, position, - ty: if let UITouchType::Pencil = touch_type { - PointerType::Unknown + kind: if let UITouchType::Pencil = touch_type { + PointerKind::Unknown } else { - PointerType::Touch(finger_id) + PointerKind::Touch(finger_id) }, }, })); @@ -553,10 +553,10 @@ impl WinitView { event: WindowEvent::PointerLeft { device_id: DEVICE_ID, position: Some(position), - ty: if let UITouchType::Pencil = touch_type { - PointerType::Unknown + kind: if let UITouchType::Pencil = touch_type { + PointerKind::Unknown } else { - PointerType::Touch(finger_id) + PointerKind::Touch(finger_id) }, }, })); diff --git a/src/platform_impl/linux/wayland/seat/pointer/mod.rs b/src/platform_impl/linux/wayland/seat/pointer/mod.rs index 2ed2f8e8ed1..c4ea31670b9 100644 --- a/src/platform_impl/linux/wayland/seat/pointer/mod.rs +++ b/src/platform_impl/linux/wayland/seat/pointer/mod.rs @@ -27,7 +27,7 @@ use sctk::seat::pointer::{ use sctk::seat::SeatState; use crate::dpi::{LogicalPosition, PhysicalPosition}; -use crate::event::{ElementState, MouseButton, MouseScrollDelta, PointerSource, PointerType, TouchPhase, WindowEvent}; +use crate::event::{ElementState, MouseButton, MouseScrollDelta, PointerSource, PointerKind, TouchPhase, WindowEvent}; use crate::platform_impl::wayland::state::WinitState; use crate::platform_impl::wayland::{self, DeviceId, WindowId}; @@ -125,7 +125,11 @@ impl PointerHandler for WinitState { // Regular events on the main surface. PointerEventKind::Enter { .. } => { self.events_sink.push_window_event( - WindowEvent::PointerEntered { device_id, position, ty: PointerType::Mouse }, + WindowEvent::PointerEntered { + device_id, + position, + kind: PointerKind::Mouse, + }, window_id, ); @@ -144,7 +148,7 @@ impl PointerHandler for WinitState { WindowEvent::PointerLeft { device_id, position: Some(position), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }, window_id, ); diff --git a/src/platform_impl/linux/wayland/seat/touch/mod.rs b/src/platform_impl/linux/wayland/seat/touch/mod.rs index eff671ab8ea..e40ca016f06 100644 --- a/src/platform_impl/linux/wayland/seat/touch/mod.rs +++ b/src/platform_impl/linux/wayland/seat/touch/mod.rs @@ -8,7 +8,7 @@ use sctk::seat::touch::{TouchData, TouchHandler}; use tracing::warn; use crate::dpi::LogicalPosition; -use crate::event::{ButtonSource, ElementState, PointerSource, PointerType, WindowEvent}; +use crate::event::{ButtonSource, ElementState, PointerKind, PointerSource, WindowEvent}; use crate::platform_impl::wayland::state::WinitState; use crate::platform_impl::wayland::{self, DeviceId, FingerId}; @@ -48,7 +48,11 @@ impl TouchHandler for WinitState { crate::event::FingerId(crate::platform_impl::FingerId::Wayland(FingerId(id))); self.events_sink.push_window_event( - WindowEvent::PointerEntered { device_id, position, ty: PointerType::Touch(finger_id) }, + WindowEvent::PointerEntered { + device_id, + position, + kind: PointerKind::Touch(finger_id), + }, window_id, ); self.events_sink.push_window_event( @@ -109,7 +113,7 @@ impl TouchHandler for WinitState { WindowEvent::PointerLeft { device_id, position: Some(position), - ty: PointerType::Touch(finger_id), + kind: PointerKind::Touch(finger_id), }, window_id, ); @@ -187,7 +191,7 @@ impl TouchHandler for WinitState { DeviceId, )), position: Some(position), - ty: PointerType::Touch(crate::event::FingerId( + kind: PointerKind::Touch(crate::event::FingerId( crate::platform_impl::FingerId::Wayland(FingerId(id)), )), }, diff --git a/src/platform_impl/linux/x11/event_processor.rs b/src/platform_impl/linux/x11/event_processor.rs index 80e552cc058..87e1e328e8e 100644 --- a/src/platform_impl/linux/x11/event_processor.rs +++ b/src/platform_impl/linux/x11/event_processor.rs @@ -23,7 +23,7 @@ use xkbcommon_dl::xkb_mod_mask_t; use crate::dpi::{PhysicalPosition, PhysicalSize}; use crate::event::{ ButtonSource, DeviceEvent, ElementState, Event, Ime, InnerSizeWriter, MouseButton, - MouseScrollDelta, PointerSource, PointerType, RawKeyEvent, TouchPhase, WindowEvent, + MouseScrollDelta, PointerKind, PointerSource, RawKeyEvent, TouchPhase, WindowEvent, }; use crate::keyboard::ModifiersState; use crate::platform_impl::common::xkb::{self, XkbState}; @@ -1185,7 +1185,11 @@ impl EventProcessor { let event = Event::WindowEvent { window_id, - event: WindowEvent::PointerEntered { device_id, position, ty: PointerType::Mouse }, + event: WindowEvent::PointerEntered { + device_id, + position, + kind: PointerKind::Mouse, + }, }; callback(&self.target, event); } @@ -1208,7 +1212,7 @@ impl EventProcessor { event: WindowEvent::PointerLeft { device_id: mkdid(event.deviceid as xinput::DeviceId), position: Some(PhysicalPosition::new(event.event_x, event.event_y)), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }, }; callback(&self.target, event); @@ -1365,7 +1369,7 @@ impl EventProcessor { event: WindowEvent::PointerEntered { device_id, position, - ty: PointerType::Touch(finger_id), + kind: PointerKind::Touch(finger_id), }, }; callback(&self.target, event); @@ -1407,7 +1411,7 @@ impl EventProcessor { event: WindowEvent::PointerLeft { device_id: mkdid(xev.deviceid as xinput::DeviceId), position: Some(position), - ty: PointerType::Touch(finger_id), + kind: PointerKind::Touch(finger_id), }, }; callback(&self.target, event); diff --git a/src/platform_impl/orbital/event_loop.rs b/src/platform_impl/orbital/event_loop.rs index 6b7ffef7a8a..3bdd860c7b4 100644 --- a/src/platform_impl/orbital/event_loop.rs +++ b/src/platform_impl/orbital/event_loop.rs @@ -488,13 +488,13 @@ impl EventLoop { event::WindowEvent::PointerEntered { device_id: event::DeviceId(DeviceId), position: dpi::PhysicalPosition::default(), - ty: event::PointerType::Mouse, + kind: event::PointerKind::Mouse, } } else { event::WindowEvent::PointerLeft { device_id: event::DeviceId(DeviceId), position: None, - ty: event::PointerType::Mouse, + kind: event::PointerKind::Mouse, } }; diff --git a/src/platform_impl/web/event_loop/window_target.rs b/src/platform_impl/web/event_loop/window_target.rs index bc175c1b7b4..e9c727f836a 100644 --- a/src/platform_impl/web/event_loop/window_target.rs +++ b/src/platform_impl/web/event_loop/window_target.rs @@ -210,7 +210,7 @@ impl ActiveEventLoop { let has_focus = has_focus.clone(); let modifiers = self.modifiers.clone(); - move |active_modifiers, device_id, position, ty| { + move |active_modifiers, device_id, position, kind| { let focus = (has_focus.get() && modifiers.get() != active_modifiers).then(|| { modifiers.set(active_modifiers); Event::WindowEvent { @@ -224,7 +224,7 @@ impl ActiveEventLoop { event: WindowEvent::PointerLeft { device_id: RootDeviceId(device_id), position: Some(position), - ty, + kind, }, }))) } @@ -235,7 +235,7 @@ impl ActiveEventLoop { let has_focus = has_focus.clone(); let modifiers = self.modifiers.clone(); - move |active_modifiers, device_id, position, ty| { + move |active_modifiers, device_id, position, kind| { let focus = (has_focus.get() && modifiers.get() != active_modifiers).then(|| { modifiers.set(active_modifiers); Event::WindowEvent { @@ -249,7 +249,7 @@ impl ActiveEventLoop { event: WindowEvent::PointerEntered { device_id: RootDeviceId(device_id), position, - ty, + kind, }, }))) } diff --git a/src/platform_impl/web/web_sys/canvas.rs b/src/platform_impl/web/web_sys/canvas.rs index e31a22753f8..c3a1c86d745 100644 --- a/src/platform_impl/web/web_sys/canvas.rs +++ b/src/platform_impl/web/web_sys/canvas.rs @@ -24,7 +24,7 @@ use super::{event, fullscreen, ResizeScaleHandle}; use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize}; use crate::error::OsError as RootOE; use crate::event::{ - ButtonSource, ElementState, InnerSizeWriter, MouseScrollDelta, PointerSource, PointerType, + ButtonSource, ElementState, InnerSizeWriter, MouseScrollDelta, PointerKind, PointerSource, }; use crate::keyboard::{Key, KeyLocation, ModifiersState, PhysicalKey}; use crate::platform_impl::{Fullscreen, OsError}; @@ -332,14 +332,14 @@ impl Canvas { pub fn on_pointer_leave(&self, handler: F) where - F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerType), + F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerKind), { self.handlers.borrow_mut().pointer_handler.on_pointer_leave(&self.common, handler) } pub fn on_pointer_enter(&self, handler: F) where - F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerType), + F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerKind), { self.handlers.borrow_mut().pointer_handler.on_pointer_enter(&self.common, handler) } diff --git a/src/platform_impl/web/web_sys/event.rs b/src/platform_impl/web/web_sys/event.rs index 2552b7a3c8d..cd4c8800d81 100644 --- a/src/platform_impl/web/web_sys/event.rs +++ b/src/platform_impl/web/web_sys/event.rs @@ -8,7 +8,7 @@ use web_sys::{KeyboardEvent, MouseEvent, Navigator, PointerEvent, WheelEvent}; use super::super::FingerId; use super::Engine; -use crate::event::{MouseButton, MouseScrollDelta, PointerType}; +use crate::event::{MouseButton, MouseScrollDelta, PointerKind}; use crate::keyboard::{Key, KeyLocation, ModifiersState, NamedKey, PhysicalKey}; bitflags::bitflags! { @@ -161,11 +161,11 @@ pub fn mouse_scroll_delta( } } -pub fn pointer_type(event: &PointerEvent, pointer_id: i32) -> PointerType { +pub fn pointer_type(event: &PointerEvent, pointer_id: i32) -> PointerKind { match event.pointer_type().as_str() { - "mouse" => PointerType::Mouse, - "touch" => PointerType::Touch(FingerId::new(pointer_id, event.is_primary()).into()), - _ => PointerType::Unknown, + "mouse" => PointerKind::Mouse, + "touch" => PointerKind::Touch(FingerId::new(pointer_id, event.is_primary()).into()), + _ => PointerKind::Unknown, } } diff --git a/src/platform_impl/web/web_sys/pointer.rs b/src/platform_impl/web/web_sys/pointer.rs index 2eaa787505c..e27987dee9f 100644 --- a/src/platform_impl/web/web_sys/pointer.rs +++ b/src/platform_impl/web/web_sys/pointer.rs @@ -8,7 +8,7 @@ use super::canvas::Common; use super::event; use super::event_handle::EventListenerHandle; use crate::dpi::PhysicalPosition; -use crate::event::{ButtonSource, ElementState, Force, PointerSource, PointerType}; +use crate::event::{ButtonSource, ElementState, Force, PointerKind, PointerSource}; use crate::keyboard::ModifiersState; #[allow(dead_code)] @@ -35,7 +35,7 @@ impl PointerHandler { pub fn on_pointer_leave(&mut self, canvas_common: &Common, mut handler: F) where - F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerType), + F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerKind), { let window = canvas_common.window.clone(); self.on_cursor_leave = @@ -45,14 +45,14 @@ impl PointerHandler { let device_id = DeviceId::new(pointer_id); let position = event::mouse_position(&event).to_physical(super::scale_factor(&window)); - let ty = event::pointer_type(&event, pointer_id); - handler(modifiers, device_id, position, ty); + let kind = event::pointer_type(&event, pointer_id); + handler(modifiers, device_id, position, kind); })); } pub fn on_pointer_enter(&mut self, canvas_common: &Common, mut handler: F) where - F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerType), + F: 'static + FnMut(ModifiersState, DeviceId, PhysicalPosition, PointerKind), { let window = canvas_common.window.clone(); self.on_cursor_enter = @@ -62,8 +62,8 @@ impl PointerHandler { let device_id = DeviceId::new(pointer_id); let position = event::mouse_position(&event).to_physical(super::scale_factor(&window)); - let ty = event::pointer_type(&event, pointer_id); - handler(modifiers, device_id, position, ty); + let kind = event::pointer_type(&event, pointer_id); + handler(modifiers, device_id, position, kind); })); } @@ -76,17 +76,17 @@ impl PointerHandler { Some(canvas_common.add_event("pointerup", move |event: PointerEvent| { let modifiers = event::mouse_modifiers(&event); let pointer_id = event.pointer_id(); - let ty = event::pointer_type(&event, pointer_id); + let kind = event::pointer_type(&event, pointer_id); let button = event::mouse_button(&event).expect("no mouse button pressed"); - let source = match ty { - PointerType::Mouse => ButtonSource::Mouse(button), - PointerType::Touch(finger_id) => ButtonSource::Touch { + let source = match kind { + PointerKind::Mouse => ButtonSource::Mouse(button), + PointerKind::Touch(finger_id) => ButtonSource::Touch { finger_id, force: Some(Force::Normalized(event.pressure().into())), }, - PointerType::Unknown => ButtonSource::Unknown(button.to_id()), + PointerKind::Unknown => ButtonSource::Unknown(button.to_id()), }; handler( @@ -119,11 +119,11 @@ impl PointerHandler { let modifiers = event::mouse_modifiers(&event); let pointer_id = event.pointer_id(); - let ty = event::pointer_type(&event, pointer_id); + let kind = event::pointer_type(&event, pointer_id); let button = event::mouse_button(&event).expect("no mouse button pressed"); - let source = match ty { - PointerType::Mouse => { + let source = match kind { + PointerKind::Mouse => { // Error is swallowed here since the error would occur every time the // mouse is clicked when the cursor is // grabbed, and there is probably not a @@ -133,11 +133,11 @@ impl PointerHandler { ButtonSource::Mouse(button) }, - PointerType::Touch(finger_id) => ButtonSource::Touch { + PointerKind::Touch(finger_id) => ButtonSource::Touch { finger_id, force: Some(Force::Normalized(event.pressure().into())), }, - PointerType::Unknown => ButtonSource::Unknown(button.to_id()), + PointerKind::Unknown => ButtonSource::Unknown(button.to_id()), }; handler( @@ -170,7 +170,7 @@ impl PointerHandler { Some(canvas_common.add_event("pointermove", move |event: PointerEvent| { let pointer_id = event.pointer_id(); let device_id = DeviceId::new(pointer_id); - let ty = event::pointer_type(&event, pointer_id); + let kind = event::pointer_type(&event, pointer_id); // chorded button event if let Some(button) = event::mouse_button(&event) { @@ -187,9 +187,9 @@ impl PointerHandler { ElementState::Released }; - let button = match ty { - PointerType::Mouse => ButtonSource::Mouse(button), - PointerType::Touch(finger_id) => { + let button = match kind { + PointerKind::Mouse => ButtonSource::Mouse(button), + PointerKind::Touch(finger_id) => { let button_id = button.to_id(); if button_id != 1 { @@ -201,7 +201,7 @@ impl PointerHandler { force: Some(Force::Normalized(event.pressure().into())), } }, - PointerType::Unknown => todo!(), + PointerKind::Unknown => todo!(), }; button_handler( @@ -224,13 +224,13 @@ impl PointerHandler { ( event::mouse_modifiers(&event), event::mouse_position(&event).to_physical(scale), - match ty { - PointerType::Mouse => PointerSource::Mouse, - PointerType::Touch(finger_id) => PointerSource::Touch { + match kind { + PointerKind::Mouse => PointerSource::Mouse, + PointerKind::Touch(finger_id) => PointerSource::Touch { finger_id, force: Some(Force::Normalized(event.pressure().into())), }, - PointerType::Unknown => PointerSource::Unknown, + PointerKind::Unknown => PointerSource::Unknown, }, ) }), diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index c25e83468d5..9d7a6c36e75 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -1519,7 +1519,7 @@ unsafe fn public_window_callback_inner( WM_MOUSEMOVE => { use crate::event::WindowEvent::{PointerEntered, PointerLeft, PointerMoved}; - use crate::event::{PointerSource, PointerType}; + use crate::event::{PointerKind, PointerSource}; let x = super::get_x_lparam(lparam as u32) as i32; let y = super::get_y_lparam(lparam as u32) as i32; @@ -1543,7 +1543,7 @@ unsafe fn public_window_callback_inner( event: PointerEntered { device_id: DEVICE_ID, position, - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }, }); @@ -1568,7 +1568,7 @@ unsafe fn public_window_callback_inner( event: PointerLeft { device_id: DEVICE_ID, position: Some(position), - ty: PointerType::Mouse, + kind: PointerKind::Mouse, }, }); }, @@ -1600,7 +1600,7 @@ unsafe fn public_window_callback_inner( }, WM_MOUSELEAVE => { - use crate::event::PointerType::Mouse; + use crate::event::PointerKind::Mouse; use crate::event::WindowEvent::PointerLeft; { @@ -1610,7 +1610,7 @@ unsafe fn public_window_callback_inner( userdata.send_event(Event::WindowEvent { window_id: RootWindowId(WindowId(window)), - event: PointerLeft { device_id: DEVICE_ID, position: None, ty: Mouse }, + event: PointerLeft { device_id: DEVICE_ID, position: None, kind: Mouse }, }); result = ProcResult::Value(0); @@ -1896,7 +1896,7 @@ unsafe fn public_window_callback_inner( WM_TOUCH => { use crate::event::ButtonSource::Touch; use crate::event::ElementState::{Pressed, Released}; - use crate::event::{PointerSource, PointerType}; + use crate::event::{PointerKind, PointerSource}; let pcount = super::loword(wparam as u32) as usize; let mut inputs = Vec::with_capacity(pcount); @@ -1933,7 +1933,7 @@ unsafe fn public_window_callback_inner( event: WindowEvent::PointerEntered { device_id: DEVICE_ID, position, - ty: PointerType::Touch(finger_id), + kind: PointerKind::Touch(finger_id), }, }); userdata.send_event(Event::WindowEvent { @@ -1960,7 +1960,7 @@ unsafe fn public_window_callback_inner( event: WindowEvent::PointerLeft { device_id: DEVICE_ID, position: Some(position), - ty: PointerType::Touch(finger_id), + kind: PointerKind::Touch(finger_id), }, }); } else if util::has_flag(input.dwFlags, TOUCHEVENTF_MOVE) { @@ -1983,7 +1983,7 @@ unsafe fn public_window_callback_inner( WM_POINTERDOWN | WM_POINTERUPDATE | WM_POINTERUP => { use crate::event::ElementState::{Pressed, Released}; - use crate::event::{ButtonSource, PointerSource, PointerType}; + use crate::event::{ButtonSource, PointerKind, PointerSource}; if let ( Some(GetPointerFrameInfoHistory), @@ -2101,10 +2101,10 @@ unsafe fn public_window_callback_inner( event: WindowEvent::PointerEntered { device_id: DEVICE_ID, position, - ty: if let PT_TOUCH = pointer_info.pointerType { - PointerType::Touch(finger_id) + kind: if let PT_TOUCH = pointer_info.pointerType { + PointerKind::Touch(finger_id) } else { - PointerType::Unknown + PointerKind::Unknown }, }, }); @@ -2140,10 +2140,10 @@ unsafe fn public_window_callback_inner( event: WindowEvent::PointerLeft { device_id: DEVICE_ID, position: Some(position), - ty: if let PT_TOUCH = pointer_info.pointerType { - PointerType::Touch(finger_id) + kind: if let PT_TOUCH = pointer_info.pointerType { + PointerKind::Touch(finger_id) } else { - PointerType::Unknown + PointerKind::Unknown }, }, });