api: remove ::dummy from Id types

`::dummy` was used for testing purposes and became redundant after
adding e.g. `from_raw` and `into_raw` methods on `Id` types.
This commit is contained in:
daxpedda 2024-09-29 15:49:45 +02:00 committed by GitHub
parent 6e1b9fa24d
commit 32cd1ad9a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 219 additions and 352 deletions

View file

@ -18,7 +18,6 @@ pub(crate) use self::window::{PlatformSpecificWindowAttributes, Window, WindowId
pub(crate) use crate::cursor::{
NoCustomCursor as PlatformCustomCursor, NoCustomCursor as PlatformCustomCursorSource,
};
use crate::event::DeviceId as RootDeviceId;
pub(crate) use crate::icon::NoIcon as PlatformIcon;
pub(crate) use crate::platform_impl::Fullscreen;
@ -29,18 +28,11 @@ pub(crate) use crate::platform_impl::Fullscreen;
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DeviceId;
impl DeviceId {
pub const fn dummy() -> Self {
DeviceId
}
}
pub(crate) const DEVICE_ID: RootDeviceId = RootDeviceId(DeviceId);
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FingerId(usize);
impl FingerId {
#[cfg(test)]
pub const fn dummy() -> Self {
FingerId(0)
}

View file

@ -14,7 +14,7 @@ use objc2_ui_kit::{
use super::app_state::{self, EventWrapper};
use super::window::WinitUIWindow;
use super::{FingerId, DEVICE_ID};
use super::FingerId;
use crate::dpi::PhysicalPosition;
use crate::event::{
ElementState, Event, FingerId as RootFingerId, Force, KeyEvent, Touch, TouchPhase, WindowEvent,
@ -198,7 +198,7 @@ declare_class!(
let gesture_event = EventWrapper::StaticEvent(Event::WindowEvent {
window_id: RootWindowId(window.id()),
event: WindowEvent::PinchGesture {
device_id: DEVICE_ID,
device_id: None,
delta: delta as f64,
phase,
},
@ -216,7 +216,7 @@ declare_class!(
let gesture_event = EventWrapper::StaticEvent(Event::WindowEvent {
window_id: RootWindowId(window.id()),
event: WindowEvent::DoubleTapGesture {
device_id: DEVICE_ID,
device_id: None,
},
});
@ -258,7 +258,7 @@ declare_class!(
let gesture_event = EventWrapper::StaticEvent(Event::WindowEvent {
window_id: RootWindowId(window.id()),
event: WindowEvent::RotationGesture {
device_id: DEVICE_ID,
device_id: None,
delta: -delta.to_degrees() as _,
phase,
},
@ -309,7 +309,7 @@ declare_class!(
let gesture_event = EventWrapper::StaticEvent(Event::WindowEvent {
window_id: RootWindowId(window.id()),
event: WindowEvent::PanGesture {
device_id: DEVICE_ID,
device_id: None,
delta: PhysicalPosition::new(dx as _, dy as _),
phase,
},
@ -530,7 +530,7 @@ impl WinitView {
touch_events.push(EventWrapper::StaticEvent(Event::WindowEvent {
window_id: RootWindowId(window.id()),
event: WindowEvent::Touch(Touch {
device_id: DEVICE_ID,
device_id: None,
finger_id: RootFingerId(FingerId(touch_id)),
location: physical_location,
force,
@ -572,7 +572,7 @@ impl WinitView {
platform_specific: KeyEventExtra {},
},
is_synthetic: false,
device_id: DEVICE_ID,
device_id: None,
},
})
})
@ -590,7 +590,7 @@ impl WinitView {
EventWrapper::StaticEvent(Event::WindowEvent {
window_id,
event: WindowEvent::KeyboardInput {
device_id: DEVICE_ID,
device_id: None,
event: KeyEvent {
state,
logical_key: Key::Named(NamedKey::Backspace),

View file

@ -944,10 +944,6 @@ impl Inner {
pub struct WindowId(usize);
impl WindowId {
pub const fn dummy() -> Self {
WindowId(0)
}
pub const fn into_raw(self) -> u64 {
self.0 as _
}