From ce389c4b8fd79d1c8e158d1df0a15d6bce9119b8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Nov 2024 15:48:55 +0300 Subject: =?UTF-8?q?fixes=20#4659=20(NewStory=20=D0=B2=D0=B5=D0=B4=D1=91?= =?UTF-8?q?=D1=82=20=D1=81=D0=B5=D0=B1=D1=8F=20=D0=BF=D0=BE-=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D0=BD=D0=BE=D0=BC=D1=83=20=D1=81=20=D1=80=D0=B0=D0=B7?= =?UTF-8?q?=D0=BD=D1=8B=D0=BC=D0=B8=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Scriver/src/tabs.cpp | 5 ++++- src/core/stdmsg/src/tabs.cpp | 13 +++++++------ 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; -- cgit v1.2.3