From 08f58817dda88e6c57fe581bef4132a41462d480 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Fri, 3 Nov 2017 19:17:10 +0300
Subject: tabSRMM: we don't close window if it has active splitter

---
 plugins/TabSRMM/src/chat_window.cpp |  3 +++
 plugins/TabSRMM/src/msgdialog.cpp   | 16 ++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 58bb9dce6e..1bc1ae0706 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -2309,6 +2309,9 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 	case WM_CLOSE:
 		if (wParam == 0 && lParam == 0) {
+			if (GetCapture() != nullptr)
+				return TRUE;
+
 			if (PluginConfig.m_EscapeCloses == 1) {
 				SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
 				return TRUE;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 2606353dc7..b2046d2473 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -3001,13 +3001,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
 		return 0;
 
 	case WM_CLOSE:
-		// esc handles error controls if we are in error state (error controls visible)
-		if (wParam == 0 && lParam == 0 && m_dwFlags & MWF_ERRORSTATE) {
-			DM_ErrorDetected(MSGERROR_CANCEL, 0);
-			return TRUE;
-		}
-
+		// usual close, not forced
 		if (wParam == 0 && lParam == 0) {
+			// esc handles error controls if we are in error state (error controls visible)
+			if (m_dwFlags & MWF_ERRORSTATE) {
+				DM_ErrorDetected(MSGERROR_CANCEL, 0);
+				return TRUE;
+			}
+			
+			if (GetCapture() != nullptr)
+				return TRUE;
+
 			if (PluginConfig.m_EscapeCloses == 1) {
 				SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
 				return TRUE;
-- 
cgit v1.2.3