summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Scriver/src/tabs.cpp5
-rw-r--r--src/core/stdmsg/src/tabs.cpp13
2 files changed, 11 insertions, 7 deletions
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp
index ae5955063c..4b5b05d826 100644
--- a/plugins/Scriver/src/tabs.cpp
+++ b/plugins/Scriver/src/tabs.cpp
@@ -917,8 +917,11 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
if (Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, dat->m_hContact))
break;
- if (LOWORD(wParam) == IDCANCEL)
+ if (LOWORD(wParam) == IDCANCEL) {
+ if (dat && dat->m_hwndActive)
+ SetFocus(dat->m_hwndActive);
return TRUE;
+ }
break;
case WM_NOTIFY:
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index b8c33d11ac..b127e1104d 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -490,8 +490,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == m_hwndStatus) {
- CMsgDialog *pDlg = (g_Settings.bTabsEnable) ? (CMsgDialog*)m_tab.GetActivePage() : m_pEmbed;
- if (pDlg != nullptr)
+ if (auto *pDlg = CurrPage())
DrawStatusIcons(pDlg->m_hContact, dis->hDC, dis->rcItem, 2);
return TRUE;
}
@@ -500,12 +499,15 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
if (LOWORD(wParam) == IDOK) {
- CMsgDialog *pDlg = (g_Settings.bTabsEnable) ? (CMsgDialog*)m_tab.GetActivePage() : m_pEmbed;
- if (pDlg != nullptr) {
+ if (auto *pDlg = CurrPage()) {
pDlg->m_btnOk.Click();
return TRUE;
}
}
+ else if (LOWORD(wParam) == IDCANCEL) {
+ if (auto *pDlg = CurrPage())
+ SetFocus(pDlg->GetHwnd());
+ }
break;
case WM_ACTIVATE:
@@ -526,8 +528,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
NMMOUSE *nm = (NMMOUSE *)lParam;
SendMessage(m_hwndStatus, SB_GETRECT, SendMessage(m_hwndStatus, SB_GETPARTS, 0, 0) - 1, (LPARAM)&rc);
if (nm->pt.x >= rc.left) {
- CMsgDialog *pDlg = (g_Settings.bTabsEnable) ? (CMsgDialog*)m_tab.GetActivePage() : m_pEmbed;
- if (pDlg != nullptr)
+ if (auto *pDlg = CurrPage())
CheckStatusIconClick(pDlg->m_hContact, m_hwndStatus, nm->pt, rc, 2, ((LPNMHDR)lParam)->code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0);
}
return TRUE;