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

Fix communication of fractional RI_MOUSE_WHEEL events (Windows) #1877

Merged
merged 7 commits into from
Mar 11, 2021
Merged

Fix communication of fractional RI_MOUSE_WHEEL events (Windows) #1877

merged 7 commits into from
Mar 11, 2021

Conversation

NNemec
Copy link
Contributor

@NNemec NNemec commented Mar 8, 2021

  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@msiglreith msiglreith self-requested a review March 9, 2021 08:09
@msiglreith msiglreith added DS - windows C - waiting on maintainer A maintainer must review this code labels Mar 9, 2021
Copy link
Member

@msiglreith msiglreith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!
Please add a short note in the CHANGELOG.md

My mouse doesn't allow finer resolutions but example works fine and the implementation looks good as well 👍

@@ -2101,7 +2101,8 @@ unsafe extern "system" fn thread_event_target_callback<T: 'static>(
}

if util::has_flag(mouse.usButtonFlags, winuser::RI_MOUSE_WHEEL) {
let delta = mouse.usButtonData as SHORT / winuser::WHEEL_DELTA;
let delta =
mouse.usButtonData as SHORT as f32 / winuser::WHEEL_DELTA as f32;
subclass_input.send_event(Event::DeviceEvent {
device_id,
event: MouseWheel {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: the cast to f32 should be removed now in delta: LineDelta(0.0, delta as f32)

@msiglreith msiglreith merged commit 86748fb into rust-windowing:master Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - waiting on maintainer A maintainer must review this code DS - windows
Development

Successfully merging this pull request may close these issues.

2 participants