diff --git a/CHANGELOG.md b/CHANGELOG.md index 828fb1fa..7c8bfd68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ - Refactored Windows state/flag-setting code. - On Windows, hiding the cursor no longer hides the cursor for all Winit windows - just the one `hide_cursor` was called on. - On Windows, cursor grabs used to get perpetually canceled when the grabbing window lost focus. Now, cursor grabs automatically get re-initialized when the window regains focus and the mouse moves over the client area. +- On Windows, only vertical mouse wheel events were handled. Now, horizontal mouse wheel events are also handled. # Version 0.18.1 (2018-12-30) diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 1d7a4aa1..ad4f3997 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -994,6 +994,22 @@ unsafe extern "system" fn public_window_callback( 0 }, + winuser::WM_MOUSEHWHEEL => { + use event::MouseScrollDelta::LineDelta; + use event::TouchPhase; + + let value = (wparam >> 16) as i16; + let value = value as i32; + let value = value as f32 / winuser::WHEEL_DELTA as f32; + + subclass_input.send_event(Event::WindowEvent { + window_id: RootWindowId(WindowId(window)), + event: WindowEvent::MouseWheel { device_id: DEVICE_ID, delta: LineDelta(value, 0.0), phase: TouchPhase::Moved, modifiers: event::get_key_mods() }, + }); + + 0 + }, + winuser::WM_KEYDOWN | winuser::WM_SYSKEYDOWN => { use event::ElementState::Pressed; use event::VirtualKeyCode;