mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
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:
@@ -1,4 +1,4 @@
|
||||
use super::{backend, event, window, HasMonitorPermissionFuture, MonitorPermissionFuture};
|
||||
use super::{backend, window, HasMonitorPermissionFuture, MonitorPermissionFuture};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::error::{EventLoopError, NotSupportedError};
|
||||
use crate::event::Event;
|
||||
|
||||
@@ -286,7 +286,7 @@ impl Shared {
|
||||
}
|
||||
|
||||
// chorded button event
|
||||
let device_id = RootDeviceId(DeviceId::new(event.pointer_id()));
|
||||
let device_id = DeviceId::new(event.pointer_id()).map(RootDeviceId);
|
||||
|
||||
if let Some(button) = backend::event::mouse_button(&event) {
|
||||
let state = if backend::event::mouse_buttons(&event).contains(button.into()) {
|
||||
@@ -327,7 +327,7 @@ impl Shared {
|
||||
|
||||
if let Some(delta) = backend::event::mouse_scroll_delta(&window, &event) {
|
||||
runner.send_event(Event::DeviceEvent {
|
||||
device_id: RootDeviceId(DeviceId::dummy()),
|
||||
device_id: None,
|
||||
event: DeviceEvent::MouseWheel { delta },
|
||||
});
|
||||
}
|
||||
@@ -344,7 +344,7 @@ impl Shared {
|
||||
|
||||
let button = backend::event::mouse_button(&event).expect("no mouse button pressed");
|
||||
runner.send_event(Event::DeviceEvent {
|
||||
device_id: RootDeviceId(DeviceId::new(event.pointer_id())),
|
||||
device_id: DeviceId::new(event.pointer_id()).map(RootDeviceId),
|
||||
event: DeviceEvent::Button {
|
||||
button: button.to_id(),
|
||||
state: ElementState::Pressed,
|
||||
@@ -363,7 +363,7 @@ impl Shared {
|
||||
|
||||
let button = backend::event::mouse_button(&event).expect("no mouse button pressed");
|
||||
runner.send_event(Event::DeviceEvent {
|
||||
device_id: RootDeviceId(DeviceId::new(event.pointer_id())),
|
||||
device_id: DeviceId::new(event.pointer_id()).map(RootDeviceId),
|
||||
event: DeviceEvent::Button {
|
||||
button: button.to_id(),
|
||||
state: ElementState::Released,
|
||||
@@ -381,7 +381,7 @@ impl Shared {
|
||||
}
|
||||
|
||||
runner.send_event(Event::DeviceEvent {
|
||||
device_id: RootDeviceId(DeviceId::dummy()),
|
||||
device_id: None,
|
||||
event: DeviceEvent::Key(RawKeyEvent {
|
||||
physical_key: backend::event::key_code(&event),
|
||||
state: ElementState::Pressed,
|
||||
@@ -399,7 +399,7 @@ impl Shared {
|
||||
}
|
||||
|
||||
runner.send_event(Event::DeviceEvent {
|
||||
device_id: RootDeviceId(DeviceId::dummy()),
|
||||
device_id: None,
|
||||
event: DeviceEvent::Key(RawKeyEvent {
|
||||
physical_key: backend::event::key_code(&event),
|
||||
state: ElementState::Released,
|
||||
|
||||
@@ -7,7 +7,6 @@ use web_sys::Element;
|
||||
|
||||
use super::super::monitor::MonitorPermissionFuture;
|
||||
use super::super::{lock, KeyEventExtra};
|
||||
use super::event::DeviceId;
|
||||
use super::runner::{EventWrapper, WeakShared};
|
||||
use super::window::WindowId;
|
||||
use super::{backend, runner, EventLoopProxy};
|
||||
@@ -144,13 +143,11 @@ impl ActiveEventLoop {
|
||||
}
|
||||
});
|
||||
|
||||
let device_id = RootDeviceId(DeviceId::dummy());
|
||||
|
||||
runner.send_events(
|
||||
iter::once(Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::KeyboardInput {
|
||||
device_id,
|
||||
device_id: None,
|
||||
event: KeyEvent {
|
||||
physical_key,
|
||||
logical_key,
|
||||
@@ -180,13 +177,11 @@ impl ActiveEventLoop {
|
||||
}
|
||||
});
|
||||
|
||||
let device_id = RootDeviceId(DeviceId::dummy());
|
||||
|
||||
runner.send_events(
|
||||
iter::once(Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::KeyboardInput {
|
||||
device_id,
|
||||
device_id: None,
|
||||
event: KeyEvent {
|
||||
physical_key,
|
||||
logical_key,
|
||||
@@ -221,7 +216,7 @@ impl ActiveEventLoop {
|
||||
|
||||
let pointer = pointer_id.map(|device_id| Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::CursorLeft { device_id: RootDeviceId(device_id) },
|
||||
event: WindowEvent::CursorLeft { device_id: device_id.map(RootDeviceId) },
|
||||
});
|
||||
|
||||
if focus.is_some() || pointer.is_some() {
|
||||
@@ -246,7 +241,7 @@ impl ActiveEventLoop {
|
||||
|
||||
let pointer = pointer_id.map(|device_id| Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::CursorEntered { device_id: RootDeviceId(device_id) },
|
||||
event: WindowEvent::CursorEntered { device_id: device_id.map(RootDeviceId) },
|
||||
});
|
||||
|
||||
if focus.is_some() || pointer.is_some() {
|
||||
@@ -272,7 +267,7 @@ impl ActiveEventLoop {
|
||||
});
|
||||
|
||||
runner.send_events(modifiers.into_iter().chain(events.flat_map(|position| {
|
||||
let device_id = RootDeviceId(pointer_id);
|
||||
let device_id = pointer_id.map(RootDeviceId);
|
||||
|
||||
iter::once(Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
@@ -301,7 +296,7 @@ impl ActiveEventLoop {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::Touch(Touch {
|
||||
finger_id: RootFingerId(finger_id),
|
||||
device_id: RootDeviceId(device_id),
|
||||
device_id: device_id.map(RootDeviceId),
|
||||
phase: TouchPhase::Moved,
|
||||
force: Some(force),
|
||||
location,
|
||||
@@ -329,7 +324,7 @@ impl ActiveEventLoop {
|
||||
}
|
||||
});
|
||||
|
||||
let device_id = RootDeviceId(device_id);
|
||||
let device_id = device_id.map(RootDeviceId);
|
||||
|
||||
let state = if buttons.contains(button.into()) {
|
||||
ElementState::Pressed
|
||||
@@ -368,7 +363,7 @@ impl ActiveEventLoop {
|
||||
}
|
||||
});
|
||||
|
||||
let device_id: RootDeviceId = RootDeviceId(pointer_id);
|
||||
let device_id = pointer_id.map(RootDeviceId);
|
||||
|
||||
// A mouse down event may come in without any prior CursorMoved events,
|
||||
// therefore we should send a CursorMoved event to make sure that the
|
||||
@@ -407,7 +402,7 @@ impl ActiveEventLoop {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::Touch(Touch {
|
||||
finger_id: RootFingerId(finger_id),
|
||||
device_id: RootDeviceId(device_id),
|
||||
device_id: device_id.map(RootDeviceId),
|
||||
phase: TouchPhase::Started,
|
||||
force: Some(force),
|
||||
location,
|
||||
@@ -434,7 +429,7 @@ impl ActiveEventLoop {
|
||||
}
|
||||
});
|
||||
|
||||
let device_id: RootDeviceId = RootDeviceId(pointer_id);
|
||||
let device_id = pointer_id.map(RootDeviceId);
|
||||
|
||||
// A mouse up event may come in without any prior CursorMoved events,
|
||||
// therefore we should send a CursorMoved event to make sure that the
|
||||
@@ -475,7 +470,7 @@ impl ActiveEventLoop {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::Touch(Touch {
|
||||
finger_id: RootFingerId(finger_id),
|
||||
device_id: RootDeviceId(device_id),
|
||||
device_id: device_id.map(RootDeviceId),
|
||||
phase: TouchPhase::Ended,
|
||||
force: Some(force),
|
||||
location,
|
||||
@@ -502,7 +497,7 @@ impl ActiveEventLoop {
|
||||
Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::MouseWheel {
|
||||
device_id: RootDeviceId(DeviceId::dummy()),
|
||||
device_id: None,
|
||||
delta,
|
||||
phase: TouchPhase::Moved,
|
||||
},
|
||||
@@ -516,7 +511,7 @@ impl ActiveEventLoop {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::Touch(Touch {
|
||||
finger_id: RootFingerId(finger_id),
|
||||
device_id: RootDeviceId(device_id),
|
||||
device_id: device_id.map(RootDeviceId),
|
||||
phase: TouchPhase::Cancelled,
|
||||
force: Some(force),
|
||||
location,
|
||||
|
||||
Reference in New Issue
Block a user