summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-04-13 20:24:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-04-13 20:24:24 +0300
commit9df1b7e422f4990b4a20eb19d14cf0bca9ab1937 (patch)
tree469aec159078a8baab4a897336adcebbaf0ff7fd /src/core/stdmsg
parent9d99e4d4e3ebc1c16cad1058d975e0e0431f53c6 (diff)
StdMsg: fix for clearing chat active state
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/src/chat_window.cpp59
-rw-r--r--src/core/stdmsg/src/stdafx.h2
2 files changed, 33 insertions, 28 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 0d5ae4e629..b51d4cff1a 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -56,14 +56,16 @@ void CChatRoomDlg::OnInitDialog()
CSuper::OnInitDialog();
m_si->pDlg = this;
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
+
if (g_Settings.bTabsEnable)
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW);
+ else
+ onActivate();
// initialize toolbar icons
Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISCHATBUTTON);
- NotifyEvent(MSG_WINDOW_EVT_OPENING);
-
m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
int mask = (int)m_log.SendMsg(EM_GETEVENTMASK, 0, 0);
@@ -90,6 +92,28 @@ void CChatRoomDlg::OnDestroy()
CSuper::OnDestroy();
}
+void CChatRoomDlg::onActivate()
+{
+ WINDOWPLACEMENT wp = {};
+ wp.length = sizeof(wp);
+ GetWindowPlacement(m_hwnd, &wp);
+ g_Settings.iX = wp.rcNormalPosition.left;
+ g_Settings.iY = wp.rcNormalPosition.top;
+ g_Settings.iWidth = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
+ g_Settings.iHeight = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
+
+ SendMessage(m_hwnd, DM_UPDATETITLE, 0, 0);
+ pci->SetActiveSession(m_si);
+ UpdateStatusBar();
+
+ if (KillTimer(m_hwnd, TIMERID_FLASHWND))
+ FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
+}
+
void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton)
{
if (!pButton->Enabled())
@@ -1116,34 +1140,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
}
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
- // fall through
+ if (LOWORD(wParam) == WA_ACTIVE)
+ onActivate();
+ break;
case WM_MOUSEACTIVATE:
- {
- WINDOWPLACEMENT wp = {};
- wp.length = sizeof(wp);
- GetWindowPlacement(m_hwnd, &wp);
- g_Settings.iX = wp.rcNormalPosition.left;
- g_Settings.iY = wp.rcNormalPosition.top;
- g_Settings.iWidth = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
- g_Settings.iHeight = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
-
- if (uMsg != WM_ACTIVATE)
- SetFocus(m_message.GetHwnd());
-
- SendMessage(m_hwnd, DM_UPDATETITLE, 0, 0);
- pci->SetActiveSession(m_si);
- UpdateStatusBar();
-
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
- if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
- db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
- if (pcli->pfnGetEvent(m_hContact, 0))
- pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
- }
+ onActivate();
+ SetFocus(m_message.GetHwnd());
break;
case WM_NOTIFY:
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index c3e8cdabd8..14bde56a30 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -204,6 +204,8 @@ class CChatRoomDlg : public CSrmmBaseDialog
int m_iSplitterX, m_iSplitterY;
+ void onActivate(void);
+
public:
CChatRoomDlg(CTabbedWindow*, SESSION_INFO*);