Skip to content

Add high resolution mouse to Windows#118

Draft
stefnotch wants to merge 3 commits intoNarsil:mainfrom
stefnotch:main
Draft

Add high resolution mouse to Windows#118
stefnotch wants to merge 3 commits intoNarsil:mainfrom
stefnotch:main

Conversation

@stefnotch
Copy link
Copy Markdown

Partial fix for #117

It only implements this for Windows.

pub enum MouseScrollDelta {
LineDelta(f32, f32),
// Not supported yet PixelDelta(PhysicalPosition<f64>),
}
Copy link
Copy Markdown
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

/// ```
#[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
Copy Markdown
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
Copy Markdown
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