summaryrefslogtreecommitdiff
path: root/plugins/NewStory
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-08-19 19:10:10 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-08-19 19:10:10 +0300
commit18facae76d28d9ce95482ff5ee07bf3ca139bc10 (patch)
treec5e68ab20b10606891f31181b55e2c2012d7f2f9 /plugins/NewStory
parent0ea5c484af5f956c87800df524bdcb55c040b2f2 (diff)
fixes #3647 (NewStory: после удаления истории чата остаётся белая дыра)
Diffstat (limited to 'plugins/NewStory')
-rw-r--r--plugins/NewStory/src/history_control.cpp67
-rw-r--r--plugins/NewStory/src/history_control.h2
2 files changed, 33 insertions, 36 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 7c33868ffe..b440f822ea 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -478,7 +478,6 @@ void NewstoryListData::RecalcScrollBar()
void NewstoryListData::ScheduleDraw()
{
bWasAtBottom = AtBottom();
- hasData = true;
redrawTimer.Stop();
redrawTimer.Start(30);
@@ -828,46 +827,44 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
return 1;
case WM_PAINT:
- if (data->hasData) {
+ /* we get so many InvalidateRect()'s that there is no point painting,
+ Windows in theory shouldn't queue up WM_PAINTs in this case but it does so
+ we'll just ignore them */
+ if (IsWindowVisible(hwnd)) {
PAINTSTRUCT ps;
HDC hdcWindow = BeginPaint(hwnd, &ps);
- /* we get so many InvalidateRect()'s that there is no point painting,
- Windows in theory shouldn't queue up WM_PAINTs in this case but it does so
- we'll just ignore them */
- if (IsWindowVisible(hwnd)) {
- RECT rc;
- GetClientRect(hwnd, &rc);
-
- HDC hdc = CreateCompatibleDC(hdcWindow);
- HBITMAP hbmSave = (HBITMAP)SelectObject(hdc, CreateCompatibleBitmap(hdcWindow, rc.right - rc.left, rc.bottom - rc.top));
-
- int height = rc.bottom - rc.top;
- int width = rc.right - rc.left;
- int top = data->scrollTopPixel;
- idx = data->scrollTopItem;
- while ((top < height) && (idx < data->totalCount))
- top += data->PaintItem(hdc, idx++, top, width);
- data->cachedMaxDrawnItem = idx;
-
- if (top <= height) {
- RECT rc2;
- SetRect(&rc2, 0, top, width, height);
-
- HBRUSH hbr = CreateSolidBrush(g_colorTable[COLOR_BACK].cl);
- FillRect(hdc, &rc2, hbr);
- DeleteObject(hbr);
- }
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+
+ HDC hdc = CreateCompatibleDC(hdcWindow);
+ HBITMAP hbmSave = (HBITMAP)SelectObject(hdc, CreateCompatibleBitmap(hdcWindow, rc.right - rc.left, rc.bottom - rc.top));
+
+ int height = rc.bottom - rc.top;
+ int width = rc.right - rc.left;
+ int top = data->scrollTopPixel;
+ idx = data->scrollTopItem;
+ while ((top < height) && (idx < data->totalCount))
+ top += data->PaintItem(hdc, idx++, top, width);
+ data->cachedMaxDrawnItem = idx;
- if (g_plugin.bOptVScroll)
- data->RecalcScrollBar();
- if (g_plugin.bDrawEdge)
- DrawEdge(hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
+ if (top <= height) {
+ RECT rc2;
+ SetRect(&rc2, 0, top, width, height);
- BitBlt(hdcWindow, 0, 0, rc.right, rc.bottom, hdc, 0, 0, SRCCOPY);
- DeleteObject(SelectObject(hdc, hbmSave));
- DeleteDC(hdc);
+ HBRUSH hbr = CreateSolidBrush(g_colorTable[COLOR_BACK].cl);
+ FillRect(hdc, &rc2, hbr);
+ DeleteObject(hbr);
}
+
+ if (g_plugin.bOptVScroll)
+ data->RecalcScrollBar();
+ if (g_plugin.bDrawEdge)
+ DrawEdge(hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
+
+ BitBlt(hdcWindow, 0, 0, rc.right, rc.bottom, hdc, 0, 0, SRCCOPY);
+ DeleteObject(SelectObject(hdc, hbmSave));
+ DeleteDC(hdc);
EndPaint(hwnd, &ps);
}
break;
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index 5bafeaa727..f98beed419 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -61,7 +61,7 @@ struct NewstoryListData : public MZeroedObject
RECT rcLastPaint;
- bool bWasShift, bSortAscending, hasData, bWasAtBottom;
+ bool bWasShift, bSortAscending, bWasAtBottom;
HWND hwnd;
HWND hwndEditBox;