From c39ea2287d194b13cef35705fdb637c519f1fa33 Mon Sep 17 00:00:00 2001 From: HaruLerrz Date: Sat, 22 Aug 2026 03:29:45 +0800 Subject: [PATCH 1/2] Fix delayed mouse wheel scrolling --- src/modules/editor.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/modules/editor.cpp b/src/modules/editor.cpp index 967cf57..c38fd65 100644 --- a/src/modules/editor.cpp +++ b/src/modules/editor.cpp @@ -255,9 +255,10 @@ LRESULT CALLBACK EditorSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break; case WM_MOUSEWHEEL: { + int delta = GET_WHEEL_DELTA_WPARAM(wParam); + if (LOWORD(wParam) & MK_SHIFT) { - int delta = GET_WHEEL_DELTA_WPARAM(wParam); UINT scrollLines = 3; SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0); if (scrollLines == (UINT)WHEEL_PAGESCROLL) @@ -271,7 +272,31 @@ LRESULT CALLBACK EditorSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } return 0; } - break; + + static int wheelDeltaRemainder = 0; + wheelDeltaRemainder += delta; + + UINT scrollLines = 3; + SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0); + + while (wheelDeltaRemainder >= WHEEL_DELTA || wheelDeltaRemainder <= -WHEEL_DELTA) + { + bool scrollUp = wheelDeltaRemainder > 0; + + if (scrollLines == (UINT)WHEEL_PAGESCROLL) + { + SendMessageW(hwnd, WM_VSCROLL, scrollUp ? SB_PAGEUP : SB_PAGEDOWN, 0); + } + else + { + for (UINT i = 0; i < scrollLines; ++i) + SendMessageW(hwnd, WM_VSCROLL, scrollUp ? SB_LINEUP : SB_LINEDOWN, 0); + } + + wheelDeltaRemainder += scrollUp ? -WHEEL_DELTA : WHEEL_DELTA; + } + + return 0; } case WM_MOUSEHWHEEL: { From 07cbe4ae24d27867dc68d9d99768c4c1c2473c88 Mon Sep 17 00:00:00 2001 From: HaruLerrz Date: Wed, 28 Oct 2026 22:44:58 +0800 Subject: [PATCH 2/2] Preserve native Ctrl+mouse-wheel behavior --- src/modules/editor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/editor.cpp b/src/modules/editor.cpp index c38fd65..93742f3 100644 --- a/src/modules/editor.cpp +++ b/src/modules/editor.cpp @@ -255,6 +255,9 @@ LRESULT CALLBACK EditorSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break; case WM_MOUSEWHEEL: { + if (LOWORD(wParam) & MK_CONTROL) + break; + int delta = GET_WHEEL_DELTA_WPARAM(wParam); if (LOWORD(wParam) & MK_SHIFT)