diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-05 11:47:37 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-05 11:47:37 +0300 |
commit | 11b0f497c9a7d13ea7caba9841d661f72389751c (patch) | |
tree | 40c9d116272d6a4c63a717cd68686a61e6e5c989 /plugins/TabSRMM | |
parent | 9ff6f169d1e2bd5bc139290d4abd6d7573fa6061 (diff) |
merge of SRMM related changes into stable
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/chat_tools.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 9 |
8 files changed, 21 insertions, 12 deletions
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 79bc186c61..c183b7b87b 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -168,7 +168,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) if (pContainer->dwFlags & CNT_DONTREPORT && IsIconic(pContainer->m_hwnd)) // in tray counts as "minimised"
goto passed;
if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED) {
- if (!IsIconic(pContainer->m_hwnd) && GetForegroundWindow() != pContainer->m_hwnd && GetActiveWindow() != pContainer->m_hwnd)
+ if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
goto passed;
}
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index da2636eccf..f7bbfa7bf2 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -738,7 +738,7 @@ void CChatRoomDlg::AddLog() DM_AddDivider(); } else { - bool bInactive = (GetForegroundWindow() != m_pContainer->m_hwnd || GetActiveWindow() != m_pContainer->m_hwnd); + bool bInactive = !IsActive(); if (bInactive) DM_AddDivider(); else if (m_pContainer->m_hwndActive != m_hwnd) @@ -1404,7 +1404,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_INPUTLANGCHANGE: - if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && m_pContainer->m_hwndActive == m_hwnd && GetForegroundWindow() == m_pContainer->m_hwnd && GetActiveWindow() == m_pContainer->m_hwnd) { + if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && IsActive()) { DM_SaveLocale(wParam, lParam); m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); return 1; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 48f8eb29e6..fbf5fe0fae 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2297,7 +2297,7 @@ void TSAPI ReflashContainer(TContainerData *pContainer) {
DWORD dwStartTime = pContainer->dwFlashingStarted;
- if (GetForegroundWindow() == pContainer->m_hwnd || GetActiveWindow() == pContainer->m_hwnd) // dont care about active windows
+ if (pContainer->IsActive()) // dont care about active windows
return;
if (pContainer->dwFlags & CNT_NOFLASH || pContainer->dwFlashingStarted == 0)
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 89d57735f9..9147944ea7 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -780,7 +780,7 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi goto passed;
if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED)
- if (!IsIconic(pContainer->m_hwnd) && GetForegroundWindow() != pContainer->m_hwnd && GetActiveWindow() != pContainer->m_hwnd)
+ if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
goto passed;
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5653d2dd2b..8148fe6d8f 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1087,7 +1087,7 @@ void CTabBaseDlg::DM_Typing(bool fForceOff) SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)m_wszStatusBar); SendMessage(hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]); } - if (IsIconic(hwndContainer) || GetForegroundWindow() != hwndContainer || GetActiveWindow() != hwndContainer) { + if (IsIconic(hwndContainer) || !IsActive()) { SetWindowText(hwndContainer, m_wszStatusBar); m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; if (!(m_pContainer->dwFlags & CNT_NOFLASH) && PluginConfig.m_FlashOnMTN) @@ -1223,7 +1223,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) DM_AddDivider(); } else if (PluginConfig.m_bUseDividers) { - if ((GetForegroundWindow() != m_pContainer->m_hwnd || GetActiveWindow() != m_pContainer->m_hwnd)) + if (!m_pContainer->IsActive()) DM_AddDivider(); else if (m_pContainer->m_hwndActive != m_hwnd) DM_AddDivider(); @@ -1294,8 +1294,8 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) // flash window if it is not focused if (!bDisableNotify && !bIsStatusChangeEvent) - if ((GetActiveWindow() != m_pContainer->m_hwnd || GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei.flags & DBEF_SENT)) { - if (!(m_pContainer->dwFlags & CNT_NOFLASH) && (GetActiveWindow() != m_pContainer->m_hwnd || GetForegroundWindow() != m_pContainer->m_hwnd)) + if (!IsActive() && !(dbei.flags & DBEF_SENT)) { + if (!(m_pContainer->dwFlags & CNT_NOFLASH) && !m_pContainer->IsActive()) FlashContainer(m_pContainer, 1, 0); SendMessage(m_pContainer->m_hwnd, DM_SETICON, (WPARAM)this, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index be9485c0e8..f324c074a5 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2123,7 +2123,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_INPUTLANGCHANGE:
- if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && m_pContainer->m_hwndActive == m_hwnd && GetForegroundWindow() == m_pContainer->m_hwnd && GetActiveWindow() == m_pContainer->m_hwnd) {
+ if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && IsActive()) {
DM_SaveLocale(wParam, lParam);
m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
return 1;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 3d3c676de8..3e3525f856 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -160,7 +160,7 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_SETLOCALE:
if (m_dwFlags & MWF_WASBACKGROUNDCREATE)
break;
- if (m_pContainer->m_hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && m_pContainer->m_hwnd == GetForegroundWindow() && m_pContainer->m_hwnd == GetActiveWindow()) {
+ if (PluginConfig.m_bAutoLocaleSupport && IsActive()) {
if (lParam)
m_hkl = (HKL)lParam;
@@ -355,7 +355,7 @@ int TSAPI MessageWindowOpened(MCONTACT hContact, HWND _hwnd) return 0;
}
if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED) {
- if (!IsIconic(pContainer->m_hwnd) && GetForegroundWindow() != pContainer->m_hwnd && GetActiveWindow() != pContainer->m_hwnd)
+ if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
return 0;
}
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5939a31633..2dd60114c3 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -232,6 +232,10 @@ struct TContainerData void ClearMargins()
{ memset(&mOld, 0xfe, sizeof(mOld));
}
+
+ bool IsActive()
+ { return GetActiveWindow() == m_hwnd && GetForegroundWindow() == m_hwnd;
+ }
};
struct SESSION_INFO;
@@ -380,6 +384,11 @@ public: __forceinline CCtrlRichEdit& GetEntry() { return m_message; }
+ bool IsActive() const override
+ {
+ return m_pContainer->IsActive() && m_pContainer->m_hwndActive == m_hwnd;
+ }
+
HWND DM_CreateClist();
void DM_EventAdded(WPARAM wParam, LPARAM lParam);
void DM_InitRichEdit();
|