diff options
author | George Hazan <george.hazan@gmail.com> | 2024-04-14 14:29:37 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-04-14 14:29:37 +0300 |
commit | bdf9b26bff9153bd5ee8fe186a370a4fbf33221a (patch) | |
tree | 701353da7e54e080c53de9f5c482d6b023baed33 | |
parent | f50127c635c82f76249e9ad7446e7349a78a0cce (diff) |
prevent CDlgBase from executing useless resize attempts
-rw-r--r-- | include/m_gui.h | 3 | ||||
-rw-r--r-- | src/mir_core/src/Windows/CDlgBase.cpp | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index 601e22456e..999db8899b 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -487,6 +487,7 @@ protected: MWindow m_hwnd = nullptr; // must be the first data item
MWindow m_hwndParent = nullptr;
int m_idDialog;
+ RECT m_rcPrev;
bool m_isModal = false;
bool m_bInitialized = false;
@@ -496,7 +497,7 @@ protected: bool m_bExiting = false; // window received WM_CLOSE and gonna die soon
enum { CLOSE_ON_OK = 0x1, CLOSE_ON_CANCEL = 0x2 };
- uint8_t m_autoClose; // automatically close dialog on IDOK/CANCEL commands. default: CLOSE_ON_OK|CLOSE_ON_CANCEL
+ uint8_t m_autoClose; // automatically close dialog on IDOK/CANCEL commands. default: CLOSE_ON_OK|CLOSE_ON_CANCEL
CMPluginBase &m_pPlugin;
diff --git a/src/mir_core/src/Windows/CDlgBase.cpp b/src/mir_core/src/Windows/CDlgBase.cpp index ac71f76d4e..40b762ced8 100644 --- a/src/mir_core/src/Windows/CDlgBase.cpp +++ b/src/mir_core/src/Windows/CDlgBase.cpp @@ -247,6 +247,8 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_bInitialized = m_bSucceeded = false;
TranslateDialog_LP(m_hwnd, &m_pPlugin);
+ GetClientRect(m_hwnd, &m_rcPrev);
+
::EnumChildWindows(m_hwnd, &GlobalFieldEnum, LPARAM(this));
NotifyControls(&CCtrlBase::OnInit);
@@ -399,7 +401,12 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_SIZE:
- OnResize();
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
+ if (memcmp(&m_rcPrev, &rc, sizeof(RECT))) {
+ OnResize();
+ m_rcPrev = rc;
+ }
return TRUE;
case WM_TIMER:
|