summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-08-22 12:39:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-08-22 12:39:16 +0300
commit85a9927c849a5cefa8a7a9af070aa880ab0e095e (patch)
treec24e2f672d17c9a649cd7ca3ed9f2a518cf780c9 /src/core/stdmsg
parent94f7b789b4fb0df06b45668db49eef5061943368 (diff)
StdMsg:
- fixes #2032 (focus is lost during tab switching); - code optimization
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/src/stdafx.h1
-rw-r--r--src/core/stdmsg/src/tabs.cpp32
2 files changed, 19 insertions, 14 deletions
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 2d1a4e18e6..2801630482 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -150,6 +150,7 @@ class CTabbedWindow : public CDlgBase
int iX = 0, iY = 0;
int iWidth = 0, iHeight = 0;
int m_windowWasCascaded = 0;
+ int m_statusHeight = 0;
public:
CCtrlPages m_tab;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 3641d583a1..008f51d506 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -153,6 +153,10 @@ bool CTabbedWindow::OnInitDialog()
m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr, WS_CHILD | WS_VISIBLE | SBT_TOOLTIPS | SBARS_SIZEGRIP, 0, 0, 0, 0, m_hwnd, nullptr, g_plugin.getInst(), nullptr);
SendMessage(m_hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
+ RECT rc;
+ GetWindowRect(m_hwndStatus, &rc);
+ m_statusHeight = rc.bottom - rc.top;
+
SetWindowPosition();
if (!g_Settings.bTabsEnable) {
@@ -187,10 +191,8 @@ void CTabbedWindow::OnDestroy()
int CTabbedWindow::Resizer(UTILRESIZECONTROL *urc)
{
if (urc->wId == IDC_TAB) {
- RECT rc;
- GetWindowRect(m_hwndStatus, &rc);
urc->rcItem.top = 1;
- urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - m_statusHeight - 1;
return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM;
}
@@ -365,22 +367,24 @@ void CTabbedWindow::TabClicked()
if (pDlg == nullptr)
return;
- SESSION_INFO *s = pDlg->m_si;
- if (s) {
- if (s->wState & STATE_TALK) {
- s->wState &= ~STATE_TALK;
- db_set_w(s->hContact, s->pszModule, "ApparentMode", 0);
+ SetFocus(pDlg->m_message.GetHwnd());
+
+ SESSION_INFO *si = pDlg->m_si;
+ if (si) {
+ if (si->wState & STATE_TALK) {
+ si->wState &= ~STATE_TALK;
+ db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
}
- if (s->wState & GC_EVENT_HIGHLIGHT) {
- s->wState &= ~GC_EVENT_HIGHLIGHT;
+ if (si->wState & GC_EVENT_HIGHLIGHT) {
+ si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (g_clistApi.pfnGetEvent(s->hContact, 0))
- g_clistApi.pfnRemoveEvent(s->hContact, GC_FAKE_EVENT);
+ if (g_clistApi.pfnGetEvent(si->hContact, 0))
+ g_clistApi.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
}
- if (!s->pDlg) {
- g_chatApi.ShowRoom(s);
+ if (!si->pDlg) {
+ g_chatApi.ShowRoom(si);
SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
}