diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-20 12:44:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-20 12:44:18 +0300 |
commit | 0c8b5d434e1b2b68ba8f21cc5d5e192f95869dcb (patch) | |
tree | 136b10dfc1e122668d5f36ecce825d6df7a4d293 /src | |
parent | 6685af71a44eb2b53c157ed23c74a4cd50b50031 (diff) |
fixes #1288
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index d2e4357dff..8d16a92200 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -420,6 +420,8 @@ LRESULT CALLBACK CSrmmWindow::TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { + int idx; + switch (msg) { case GC_ADDTAB: AddPage((SESSION_INFO*)lParam); @@ -467,19 +469,17 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case GC_REMOVETAB: - { - int idx = (lParam) ? m_tab.GetDlgIndex((CDlgBase*)lParam) : TabCtrl_GetCurSel(m_tab.GetHwnd()); - if (idx == -1) - break; - - m_tab.RemovePage(idx); - if (m_tab.GetCount() == 0) - PostMessage(m_hwnd, WM_CLOSE, 0, 0); - else { - if (m_tab.GetNthPage(idx) == nullptr) - idx--; - m_tab.ActivatePage(idx); - } + idx = (lParam) ? m_tab.GetDlgIndex((CDlgBase*)lParam) : TabCtrl_GetCurSel(m_tab.GetHwnd()); + if (idx == -1) + break; + + m_tab.RemovePage(idx); + if (m_tab.GetCount() == 0) + PostMessage(m_hwnd, WM_CLOSE, 0, 0); + else { + if (m_tab.GetNthPage(idx) == nullptr) + idx--; + m_tab.ActivatePage(idx); } break; @@ -519,7 +519,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case GC_RENAMETAB: if (CChatRoomDlg *pDlg = (CChatRoomDlg*)lParam) { - int idx = m_tab.GetDlgIndex(pDlg); + idx = m_tab.GetDlgIndex(pDlg); if (idx == -1) break; @@ -561,6 +561,15 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } break; + case WM_ACTIVATE: + if (LOWORD(wParam) == WA_INACTIVE) + break; + + idx = TabCtrl_GetCurSel(m_tab.GetHwnd()); + if (idx != -1) + m_tab.ActivatePage(idx); + break; + case WM_NOTIFY: if (((LPNMHDR)lParam)->hwndFrom == m_hwndStatus) { if (((LPNMHDR)lParam)->code == NM_CLICK || ((LPNMHDR)lParam)->code == NM_RCLICK) { |