diff options
-rw-r--r-- | plugins/TabSRMM/src/contactcache.cpp | 11 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 98 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/taskbar.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/version.h | 2 |
5 files changed, 65 insertions, 54 deletions
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index e597abe53c..cd31fae67a 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -97,8 +97,10 @@ void CContactCache::resetMeta() void CContactCache::closeWindow() { - if (m_dat) - ::SendMessage(m_dat->GetHwnd(), WM_CLOSE, 1, 2); + if (m_dat) { + m_dat->m_bForcedClose = true; + m_dat->Close(); + } } ///////////////////////////////////////////////////////////////////////////////////////// @@ -301,9 +303,12 @@ void CContactCache::deletedHandler() { cc = &ccInvalid; m_isValid = false; - if (m_dat) + if (m_dat) { + m_dat->m_bForcedClose = true; + // this message must be sent async to allow a contact to rest in peace before window gets closed ::PostMessage(m_dat->GetHwnd(), WM_CLOSE, 1, 2); + } releaseAlloced(); m_hContact = INVALID_CONTACT_ID; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 861469d289..2a3f18fc2c 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -666,6 +666,54 @@ bool CMsgDialog::OnInitDialog() return true;
}
+bool CMsgDialog::OnClose()
+{
+ // usual close, not forced
+ if (!m_bForcedClose) {
+ // esc handles error controls if we are in error state (error controls visible)
+ if (m_bErrorState) {
+ DM_ErrorDetected(MSGERROR_CANCEL, 0);
+ return false;
+ }
+
+ switch (PluginConfig.m_EscapeCloses) {
+ case 1: // minimize container
+ SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ return false;
+
+ case 2: // close or hide, optionally
+ if (PluginConfig.m_bHideOnClose) {
+ ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
+ return false;
+ }
+ break;
+
+ case 3: // do nothing
+ _dlgReturn(m_hwnd, FALSE);
+ return false;
+ }
+ _dlgReturn(m_hwnd, TRUE);
+ }
+
+ if (m_iOpenJobs > 0 && !m_bForcedClose) {
+ if (m_bErrorState)
+ DM_ErrorDetected(MSGERROR_CANCEL, 1);
+ else {
+ if (m_bWarnClose)
+ return false;
+
+ m_bWarnClose = true;
+ LRESULT result = SendQueue::WarnPendingJobs(0);
+ m_bWarnClose = false;
+ if (result == IDNO)
+ return false;
+ }
+ }
+
+ CloseTab();
+ return true;
+}
+
void CMsgDialog::OnDestroy()
{
NotifyEvent(MSG_WINDOW_EVT_CLOSING);
@@ -1962,8 +2010,9 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) return 0;
}
- if (ProcessHotkeys(wParam, isShift, isCtrl, isAlt))
- return 0;
+ if (wParam != VK_ESCAPE)
+ if (ProcessHotkeys(wParam, isShift, isCtrl, isAlt))
+ return 0;
}
if (wParam != VK_RIGHT && wParam != VK_LEFT) {
@@ -3096,51 +3145,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
return 0;
- case WM_CLOSE:
- // usual close, not forced
- if (wParam == 0 && lParam == 0) {
- // esc handles error controls if we are in error state (error controls visible)
- if (m_bErrorState) {
- DM_ErrorDetected(MSGERROR_CANCEL, 0);
- return TRUE;
- }
-
- switch (PluginConfig.m_EscapeCloses) {
- case 1: // minimize container
- SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- return TRUE;
-
- case 2: // close or hide, optionally
- if (PluginConfig.m_bHideOnClose) {
- ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
- return TRUE;
- }
- break;
-
- case 3: // do nothing
- _dlgReturn(m_hwnd, FALSE);
- return TRUE;
- }
- _dlgReturn(m_hwnd, TRUE);
- }
-
- if (m_iOpenJobs > 0 && lParam != 2) {
- if (m_bErrorState)
- DM_ErrorDetected(MSGERROR_CANCEL, 1);
- else {
- if (m_bWarnClose)
- return TRUE;
-
- m_bWarnClose = true;
- LRESULT result = SendQueue::WarnPendingJobs(0);
- m_bWarnClose = false;
- if (result == IDNO)
- return TRUE;
- }
- }
- CloseTab();
- return 0;
-
case WM_DWMCOMPOSITIONCHANGED:
BB_RefreshTheme();
m_pContainer->ClearMargins();
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 3aaa1e574d..6deb8bf7d9 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -469,6 +469,7 @@ public: bool m_bEditNotesActive;
bool m_bShowAvatar;
bool m_bSaveBtn, m_bNeedCheckSize;
+ bool m_bForcedClose;
bool m_bErrorState;
bool m_bDividerWanted, m_bDividerSet;
bool m_bSplitterOverride;
@@ -544,6 +545,7 @@ public: int OnFilter(MSGFILTER *);
bool OnInitDialog() override;
+ bool OnClose() override;
void OnDestroy() override;
int Resizer(UTILRESIZECONTROL *urc) override;
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index b29530936f..ada97b4105 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -270,16 +270,16 @@ void CProxyWindow::sendPreview() return;
FORMATRANGE fr = {};
- POINT pt = { 0 };
+ POINT pt = {};
RECT rcContainer, rcTemp, rcRich, rcLog;
HDC hdc, dc;
int twips = (int)(15.0f / PluginConfig.m_DPIscaleY);
bool fIsChat = m_dat->isChat();
HWND hwndRich = m_dat->m_pLog->GetHwnd();
- POINT ptOrigin = { 0 }, ptBottom;
+ POINT ptOrigin = {}, ptBottom;
if (m_dat->m_bNeedCheckSize) {
- RECT rcClient;
+ RECT rcClient;
m_dat->m_pContainer->QueryClientArea(rcClient);
::MoveWindow(m_dat->GetHwnd(), rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top), FALSE);
::SendMessage(m_dat->GetHwnd(), WM_SIZE, 0, 0);
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index ff0f96126a..dd583941e3 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3
#define __MINOR_VERSION 6
#define __RELEASE_NUM 1
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>
|