aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorZufu Liu <unknown>2022-10-23 08:45:52 +1100
committerZufu Liu <unknown>2022-10-23 08:45:52 +1100
commitff043e669aabcfbc71180fde97c9ef28bfe01c02 (patch)
treeadaedbe69f50af639539993e5a1920bf9c49cb5f /win32/PlatWin.cxx
parent758ee3666b0ee5b1adc91c269ec845f9db6f8dea (diff)
downloadscintilla-mirror-ff043e669aabcfbc71180fde97c9ef28bfe01c02.tar.gz
Feature [feature-requests:#1457] Reuse MouseWheelDelta for autocompletion lists.
This code triggers when wheel rotated and mouse is outside list.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 87840ff3b..bb808b4e7 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -2895,7 +2895,7 @@ class ListBoxX : public ListBox {
PRectangle rcPreSize;
Point dragOffset;
Point location; // Caret location at which the list is opened
- int wheelDelta; // mouse wheel residue
+ MouseWheelDelta wheelDelta;
ListOptions options;
DWORD frameStyle = WS_THICKFRAME;
@@ -2927,7 +2927,7 @@ public:
desiredVisibleRows(9), maxItemCharacters(0), aveCharWidth(8),
parent(nullptr), ctrlID(0), dpi(USER_DEFAULT_SCREEN_DPI),
delegate(nullptr),
- widestItem(nullptr), maxCharWidth(1), resizeHit(0), wheelDelta(0) {
+ widestItem(nullptr), maxCharWidth(1), resizeHit(0) {
}
ListBoxX(const ListBoxX &) = delete;
ListBoxX(ListBoxX &&) = delete;
@@ -3689,21 +3689,15 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
}
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
case WM_MOUSEWHEEL:
- wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam);
- if (std::abs(wheelDelta) >= WHEEL_DELTA) {
+ if (wheelDelta.Accumulate(wParam)) {
const int nRows = GetVisibleRows();
int linesToScroll = std::clamp(nRows - 1, 1, 3);
- linesToScroll *= (wheelDelta / WHEEL_DELTA);
+ linesToScroll *= wheelDelta.Actions();
int top = ListBox_GetTopIndex(lb) + linesToScroll;
if (top < 0) {
top = 0;
}
ListBox_SetTopIndex(lb, top);
- // update wheel delta residue
- if (wheelDelta >= 0)
- wheelDelta = wheelDelta % WHEEL_DELTA;
- else
- wheelDelta = - (-wheelDelta % WHEEL_DELTA);
}
break;