From b6f4df821380405c6bfa4a53f9db3874173e4b32 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Oct 2023 21:03:41 +0300 Subject: NewStory: another attempt to fix SB_THUMBTRACK --- plugins/NewStory/src/history_control.cpp | 7 +++++-- plugins/NewStory/src/stdafx.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index 0b1c045ff1..365ad3e8aa 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -375,9 +375,9 @@ void NewstoryListData::EnsureVisible(int item) RECT rc; GetClientRect(m_hwnd, &rc); int height = rc.bottom - rc.top; - int top = scrollTopPixel; int idx = scrollTopItem; int itemHeight = GetItemHeight(idx); + int top = itemHeight + scrollTopPixel; bool found = false; while (top < height) { if (idx == item) { @@ -1171,7 +1171,10 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM si.cbSize = sizeof(si); si.fMask = SIF_ALL; GetScrollInfo(hwnd, SB_VERT, &si); - data->EnsureVisible(si.nTrackPos); + + data->scrollTopItem = si.nTrackPos; + data->scrollTopPixel = 0; + data->FixScrollPosition(); break; default: diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h index c22b02d497..70039c4c3f 100644 --- a/plugins/NewStory/src/stdafx.h +++ b/plugins/NewStory/src/stdafx.h @@ -40,11 +40,11 @@ along with this program. If not, see . #include #include #include +#include #include #include #include #include -#include #include #include #include -- cgit v1.2.3