Skip to content
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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

stefnotch
Copy link

Partial fix for #117

It only implements this for Windows.

#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
pub enum MouseScrollDelta {
LineDelta(f32, f32),
// Not supported yet PixelDelta(PhysicalPosition<f64>),
}
Copy link
Author

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>
Copy link
Author

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)?;
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant