From ff043e669aabcfbc71180fde97c9ef28bfe01c02 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Sun, 23 Oct 2022 08:45:52 +1100 Subject: Feature [feature-requests:#1457] Reuse MouseWheelDelta for autocompletion lists. This code triggers when wheel rotated and mouse is outside list. --- win32/PlatWin.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'win32/PlatWin.h') diff --git a/win32/PlatWin.h b/win32/PlatWin.h index 893618b38..68098f9c7 100644 --- a/win32/PlatWin.h +++ b/win32/PlatWin.h @@ -49,6 +49,20 @@ int SystemMetricsForDpi(int nIndex, UINT dpi) noexcept; HCURSOR LoadReverseArrowCursor(UINT dpi) noexcept; +class MouseWheelDelta { + int wheelDelta = 0; +public: + bool Accumulate(WPARAM wParam) noexcept { + wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam); + return std::abs(wheelDelta) >= WHEEL_DELTA; + } + int Actions() noexcept { + const int actions = wheelDelta / WHEEL_DELTA; + wheelDelta = wheelDelta % WHEEL_DELTA; + return actions; + } +}; + #if defined(USE_D2D) extern bool LoadD2D(); extern ID2D1Factory *pD2DFactory; -- cgit v1.2.3