-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add high resolution mouse to Windows #118
base: main
Are you sure you want to change the base?
Conversation
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] | ||
pub enum MouseScrollDelta { | ||
LineDelta(f32, f32), | ||
// Not supported yet PixelDelta(PhysicalPosition<f64>), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This imitates the Winit API
@@ -357,11 +351,17 @@ pub use crate::windows::grab as _grab; | |||
/// } | |||
/// ``` | |||
#[cfg(feature = "unstable_grab")] | |||
pub fn grab<T>(callback: T) -> Result<(), GrabError> | |||
pub fn grab<T>(event_types: EventTypes, callback: T) -> Result<(), GrabError> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a useful optimisation on platforms like Windows.
set_mouse_hook(raw_callback)?; | ||
|
||
if event_types.keyboard { | ||
set_key_hook(raw_callback)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, the current keyboard hook can break things.
With my (very custom) keyboard, a few shortcuts do not work if I register this hook.
Partial fix for #117
It only implements this for Windows.