summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-19 20:05:00 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-19 20:05:05 +0300
commit0778a82d214440276277624963bc275dfc606f59 (patch)
tree39abca519f2b54c8b326b900e7a929996a7a023e
parent1bf022db57fb4b93a0e356d3da82ff27e80a9c96 (diff)
fixes #4687 (TabSRMM: при автооткрытии новой вкладки что-то не то с размерами окна)
-rw-r--r--plugins/NewStory/src/history_control.cpp10
-rw-r--r--plugins/NewStory/src/history_control.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 9d3f85cf61..7b95412522 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -88,8 +88,12 @@ void NewstoryListData::OnContextMenu(int index, POINT pt)
Menu_DestroyNestedMenu(hMenu);
}
-void NewstoryListData::OnResize(int newWidth, int newHeight)
+void NewstoryListData::OnResize()
{
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
+ int newWidth = rc.right - rc.left, newHeight = rc.bottom - rc.top;
+
if (dib.width() < newWidth || dib.height() < newHeight) {
dib.destroy();
dib.create(newWidth, newHeight, true);
@@ -110,7 +114,7 @@ void NewstoryListData::OnResize(int newWidth, int newHeight)
}
if (bDraw)
- InvalidateRect(m_hwnd, 0, FALSE);
+ ScheduleDraw();
}
void NewstoryListData::AddChatEvent(SESSION_INFO *si, const LOGINFO *lin)
@@ -1250,7 +1254,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case WM_SIZE:
- data->OnResize(LOWORD(lParam), HIWORD(lParam));
+ data->OnResize();
break;
case WM_COMMAND:
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index db03cde2ee..8b95ed2e1b 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -126,7 +126,7 @@ struct NewstoryListData : public MZeroedObject
simpledib::dib dib;
void OnContextMenu(int index, POINT pt);
- void OnResize(int newWidth, int newHeight);
+ void OnResize();
void onTimer_Draw(CTimer *pTimer);