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:
parent
6e1b9fa24d
commit
32cd1ad9a7
35 changed files with 219 additions and 352 deletions
|
|
@ -81,7 +81,7 @@ use crate::platform_impl::platform::window_state::{
|
|||
CursorFlags, ImeState, WindowFlags, WindowState,
|
||||
};
|
||||
use crate::platform_impl::platform::{
|
||||
raw_input, util, wrap_device_id, FingerId, Fullscreen, WindowId, DEVICE_ID,
|
||||
raw_input, util, wrap_device_id, FingerId, Fullscreen, WindowId,
|
||||
};
|
||||
use crate::platform_impl::Window;
|
||||
use crate::utils::Lazy;
|
||||
|
|
@ -1047,7 +1047,7 @@ unsafe fn public_window_callback_inner(
|
|||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: KeyboardInput {
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
event: event.event,
|
||||
is_synthetic: event.is_synthetic,
|
||||
},
|
||||
|
|
@ -1541,7 +1541,7 @@ unsafe fn public_window_callback_inner(
|
|||
drop(w);
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: CursorEntered { device_id: DEVICE_ID },
|
||||
event: CursorEntered { device_id: None },
|
||||
});
|
||||
|
||||
// Calling TrackMouseEvent in order to receive mouse leave events.
|
||||
|
|
@ -1562,7 +1562,7 @@ unsafe fn public_window_callback_inner(
|
|||
drop(w);
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: CursorLeft { device_id: DEVICE_ID },
|
||||
event: CursorLeft { device_id: None },
|
||||
});
|
||||
},
|
||||
PointerMoveKind::None => drop(w),
|
||||
|
|
@ -1581,7 +1581,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: CursorMoved { device_id: DEVICE_ID, position },
|
||||
event: CursorMoved { device_id: None, position },
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1597,7 +1597,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: CursorLeft { device_id: DEVICE_ID },
|
||||
event: CursorLeft { device_id: None },
|
||||
});
|
||||
|
||||
result = ProcResult::Value(0);
|
||||
|
|
@ -1614,7 +1614,7 @@ unsafe fn public_window_callback_inner(
|
|||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: WindowEvent::MouseWheel {
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
delta: LineDelta(0.0, value),
|
||||
phase: TouchPhase::Moved,
|
||||
},
|
||||
|
|
@ -1634,7 +1634,7 @@ unsafe fn public_window_callback_inner(
|
|||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: WindowEvent::MouseWheel {
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
delta: LineDelta(value, 0.0),
|
||||
phase: TouchPhase::Moved,
|
||||
},
|
||||
|
|
@ -1668,7 +1668,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput { device_id: DEVICE_ID, state: Pressed, button: Left },
|
||||
event: MouseInput { device_id: None, state: Pressed, button: Left },
|
||||
});
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
|
@ -1684,7 +1684,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput { device_id: DEVICE_ID, state: Released, button: Left },
|
||||
event: MouseInput { device_id: None, state: Released, button: Left },
|
||||
});
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
|
@ -1700,7 +1700,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput { device_id: DEVICE_ID, state: Pressed, button: Right },
|
||||
event: MouseInput { device_id: None, state: Pressed, button: Right },
|
||||
});
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
|
@ -1716,7 +1716,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput { device_id: DEVICE_ID, state: Released, button: Right },
|
||||
event: MouseInput { device_id: None, state: Released, button: Right },
|
||||
});
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
|
@ -1732,7 +1732,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput { device_id: DEVICE_ID, state: Pressed, button: Middle },
|
||||
event: MouseInput { device_id: None, state: Pressed, button: Middle },
|
||||
});
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
|
@ -1748,7 +1748,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput { device_id: DEVICE_ID, state: Released, button: Middle },
|
||||
event: MouseInput { device_id: None, state: Released, button: Middle },
|
||||
});
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
|
@ -1766,7 +1766,7 @@ unsafe fn public_window_callback_inner(
|
|||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput {
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
state: Pressed,
|
||||
button: match xbutton {
|
||||
1 => Back,
|
||||
|
|
@ -1791,7 +1791,7 @@ unsafe fn public_window_callback_inner(
|
|||
userdata.send_event(Event::WindowEvent {
|
||||
window_id: CoreWindowId(WindowId(window)),
|
||||
event: MouseInput {
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
state: Released,
|
||||
button: match xbutton {
|
||||
1 => Back,
|
||||
|
|
@ -1855,7 +1855,7 @@ unsafe fn public_window_callback_inner(
|
|||
id: input.dwID,
|
||||
primary: util::has_flag(input.dwFlags, TOUCHEVENTF_PRIMARY),
|
||||
}),
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
|
@ -2007,7 +2007,7 @@ unsafe fn public_window_callback_inner(
|
|||
POINTER_FLAG_PRIMARY,
|
||||
),
|
||||
}),
|
||||
device_id: DEVICE_ID,
|
||||
device_id: None,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
|
@ -2435,7 +2435,7 @@ unsafe fn handle_raw_input(userdata: &ThreadMsgTargetData, data: RAWINPUT) {
|
|||
use crate::event::ElementState::{Pressed, Released};
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
|
||||
let device_id = wrap_device_id(data.header.hDevice as _);
|
||||
let device_id = Some(wrap_device_id(data.header.hDevice as _));
|
||||
|
||||
if data.header.dwType == RIM_TYPEMOUSE {
|
||||
let mouse = unsafe { data.data.mouse };
|
||||
|
|
|
|||
|
|
@ -62,12 +62,6 @@ unsafe impl Sync for PlatformSpecificWindowAttributes {}
|
|||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct DeviceId(u32);
|
||||
|
||||
impl DeviceId {
|
||||
pub const fn dummy() -> Self {
|
||||
DeviceId(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl DeviceId {
|
||||
pub fn persistent_identifier(&self) -> Option<String> {
|
||||
if self.0 != 0 {
|
||||
|
|
@ -85,6 +79,7 @@ pub struct FingerId {
|
|||
}
|
||||
|
||||
impl FingerId {
|
||||
#[cfg(test)]
|
||||
pub const fn dummy() -> Self {
|
||||
FingerId { id: 0, primary: false }
|
||||
}
|
||||
|
|
@ -96,9 +91,6 @@ impl FingerId {
|
|||
}
|
||||
}
|
||||
|
||||
// Constant device ID, to be removed when this backend is updated to report real device IDs.
|
||||
const DEVICE_ID: RootDeviceId = RootDeviceId(DeviceId(0));
|
||||
|
||||
fn wrap_device_id(id: u32) -> RootDeviceId {
|
||||
RootDeviceId(DeviceId(id))
|
||||
}
|
||||
|
|
@ -115,10 +107,6 @@ unsafe impl Send for WindowId {}
|
|||
unsafe impl Sync for WindowId {}
|
||||
|
||||
impl WindowId {
|
||||
pub const fn dummy() -> Self {
|
||||
WindowId(0)
|
||||
}
|
||||
|
||||
pub const fn into_raw(self) -> u64 {
|
||||
self.0 as u64
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue