From bdb3d72d3719a6c23e179ddff7fa975afa381aea Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 11 Jun 2018 17:34:56 +0200 Subject: [PATCH] Examples: Win32: Fixed handling of mouse wheel messages to support finer position messages (typically sent by track-pads). (#1874) --- CHANGELOG.txt | 1 + examples/imgui_impl_win32.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index bca73159..5d5725a4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -77,6 +77,7 @@ Other Changes: - ImFontConfig: Added GlyphMinAdvanceX/GlyphMaxAdvanceX settings useful to make a font appears monospaced, particularly useful for icon fonts. (#1869) - ImFontAtlas: Added GetGlyphRangesChineseSimplifiedCommon() helper that returns a list of ~2500 most common Simplified Chinese characters. (#1859) [@JX-Master, @ocornut] - Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000] + - Examples: Win32: Fixed handling of mouse wheel messages to support finer position messages (typically sent by track-pads). (#1874) [zx64] - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag. - Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches. - Internals: PushItemFlag() flags are inherited by BeginChild(). diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index fbc56a3f..19eb8773 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -13,6 +13,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2018-06-10: Inputs: Fixed handling of mouse wheel messages to support fine position messages (typically sent by track-pads). // 2018-06-08: Misc: Extracted imgui_impl_win32.cpp/.h away from the old combined DX9/DX10/DX11/DX12 examples. // 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoMouseCursorChange flag. // 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling). @@ -210,10 +211,10 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa return 0; } case WM_MOUSEWHEEL: - io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; + io.MouseWheel += (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA; return 0; case WM_MOUSEHWHEEL: - io.MouseWheelH += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; + io.MouseWheelH += (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA; return 0; case WM_KEYDOWN: case WM_SYSKEYDOWN: