chore: remove platform FingerId
The same as for `WindowId`.
This commit is contained in:
parent
c8c1eca3c7
commit
edfb4b03f4
20 changed files with 71 additions and 172 deletions
|
|
@ -65,8 +65,7 @@ use crate::application::ApplicationHandler;
|
|||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::error::{EventLoopError, RequestError};
|
||||
use crate::event::{
|
||||
Event, FingerId as RootFingerId, Force, Ime, RawKeyEvent, SurfaceSizeWriter, TouchPhase,
|
||||
WindowEvent,
|
||||
Event, FingerId, Force, Ime, RawKeyEvent, SurfaceSizeWriter, TouchPhase, WindowEvent,
|
||||
};
|
||||
use crate::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
|
|
@ -87,7 +86,7 @@ use crate::platform_impl::platform::window::InitData;
|
|||
use crate::platform_impl::platform::window_state::{
|
||||
CursorFlags, ImeState, WindowFlags, WindowState,
|
||||
};
|
||||
use crate::platform_impl::platform::{raw_input, util, wrap_device_id, FingerId, Fullscreen};
|
||||
use crate::platform_impl::platform::{raw_input, util, wrap_device_id, Fullscreen};
|
||||
use crate::platform_impl::Window;
|
||||
use crate::utils::Lazy;
|
||||
use crate::window::{
|
||||
|
|
@ -2012,7 +2011,7 @@ unsafe fn public_window_callback_inner(
|
|||
let position = PhysicalPosition::new(x, y);
|
||||
|
||||
let window_id = WindowId::from_raw(window as usize);
|
||||
let finger_id = RootFingerId(FingerId { id: input.dwID });
|
||||
let finger_id = FingerId::from_raw(input.dwID as usize);
|
||||
let primary = util::has_flag(input.dwFlags, TOUCHEVENTF_PRIMARY);
|
||||
|
||||
if util::has_flag(input.dwFlags, TOUCHEVENTF_DOWN) {
|
||||
|
|
@ -2183,7 +2182,7 @@ unsafe fn public_window_callback_inner(
|
|||
let position = PhysicalPosition::new(x, y);
|
||||
|
||||
let window_id = WindowId::from_raw(window as usize);
|
||||
let finger_id = RootFingerId(FingerId { id: pointer_info.pointerId });
|
||||
let finger_id = FingerId::from_raw(pointer_info.pointerId as usize);
|
||||
let primary = util::has_flag(pointer_info.pointerFlags, POINTER_FLAG_PRIMARY);
|
||||
|
||||
if util::has_flag(pointer_info.pointerFlags, POINTER_FLAG_DOWN) {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ impl KeyEventBuilder {
|
|||
MatchResult::MessagesToDispatch(self.pending.complete_multi(key_events))
|
||||
},
|
||||
WM_KILLFOCUS => {
|
||||
// sythesize keyup events
|
||||
// synthesize keyup events
|
||||
let kbd_state = get_kbd_state();
|
||||
let key_events = Self::synthesize_kbd_state(ElementState::Released, &kbd_state);
|
||||
MatchResult::MessagesToDispatch(self.pending.complete_multi(key_events))
|
||||
|
|
@ -333,11 +333,11 @@ impl KeyEventBuilder {
|
|||
// We are synthesizing the press event for caps-lock first for the following reasons:
|
||||
// 1. If caps-lock is *not* held down but *is* active, then we have to synthesize all
|
||||
// printable keys, respecting the caps-lock state.
|
||||
// 2. If caps-lock is held down, we could choose to sythesize its keypress after every other
|
||||
// key, in which case all other keys *must* be sythesized as if the caps-lock state was
|
||||
// be the opposite of what it currently is.
|
||||
// 2. If caps-lock is held down, we could choose to synthesize its keypress after every
|
||||
// other key, in which case all other keys *must* be sythesized as if the caps-lock state
|
||||
// was be the opposite of what it currently is.
|
||||
// --
|
||||
// For the sake of simplicity we are choosing to always sythesize
|
||||
// For the sake of simplicity we are choosing to always synthesize
|
||||
// caps-lock first, and always use the current caps-lock state
|
||||
// to determine the produced text
|
||||
if is_key_pressed!(VK_CAPITAL) {
|
||||
|
|
|
|||
|
|
@ -59,18 +59,6 @@ impl Default for PlatformSpecificWindowAttributes {
|
|||
unsafe impl Send for PlatformSpecificWindowAttributes {}
|
||||
unsafe impl Sync for PlatformSpecificWindowAttributes {}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct FingerId {
|
||||
id: u32,
|
||||
}
|
||||
|
||||
impl FingerId {
|
||||
#[cfg(test)]
|
||||
pub const fn dummy() -> Self {
|
||||
FingerId { id: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
fn wrap_device_id(id: u32) -> DeviceId {
|
||||
DeviceId::from_raw(id as i64)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue