summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-24 19:20:11 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-24 19:20:11 +0300
commit429f6f8dc6e73348426b58b388360ce94507092c (patch)
tree65f7e58d2675e02f067050d1a96ac59451cd2036 /src/core
parent214a9afdb87700c80af08790b7cb967153cb932d (diff)
StdMsg: flicker optimization, part 2
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/src/msgs.cpp21
-rw-r--r--src/core/stdmsg/src/stdafx.h2
2 files changed, 15 insertions, 8 deletions
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index d2b21d2173..68d21de96a 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -81,10 +81,16 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
HWND hwnd = Srmm_FindWindow(hContact);
if (hwnd) {
if (!g_plugin.bDoNotStealFocus) {
- ShowWindow(hwnd, SW_RESTORE);
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
- SetForegroundWindow(hwnd);
- Skin_PlaySound("RecvMsgActive");
+ if (!g_Settings.bTabsEnable) {
+ ShowWindow(hwnd, SW_RESTORE);
+ SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
+ SetForegroundWindow(hwnd);
+ Skin_PlaySound("RecvMsgActive");
+ }
+ else {
+ CSrmmBaseDialog *pDlg = (CSrmmBaseDialog*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ g_pTabDialog->m_tab.ActivatePage(g_pTabDialog->m_tab.GetDlgIndex(pDlg));
+ }
}
else {
if (GetForegroundWindow() == GetParent(hwnd))
@@ -119,6 +125,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *pwszInitialText)
hContact = db_mc_tryMeta(hContact);
HWND hwnd = Srmm_FindWindow(hContact);
+ HWND hwndContainer;
if (hwnd) {
if (pwszInitialText) {
SendDlgItemMessage(hwnd, IDC_SRMM_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_SRMM_MESSAGE, WM_GETTEXTLENGTH, 0, 0));
@@ -126,9 +133,8 @@ INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *pwszInitialText)
mir_free(pwszInitialText);
}
+ hwndContainer = GetParent(hwnd);
if (!g_Settings.bTabsEnable) {
- HWND hwndContainer = GetParent(hwnd);
- ShowWindow(hwndContainer, SW_RESTORE);
SetWindowPos(hwndContainer, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
SetForegroundWindow(hwndContainer);
}
@@ -137,8 +143,9 @@ INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *pwszInitialText)
g_pTabDialog->m_tab.ActivatePage(g_pTabDialog->m_tab.GetDlgIndex(pDlg));
}
}
- else GetContainer()->AddPage(hContact, pwszInitialText, false);
+ else hwndContainer = GetContainer()->AddPage(hContact, pwszInitialText, false)->GetHwnd();
+ ShowWindow(hwndContainer, SW_RESTORE);
return 0;
}
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 2255d06693..10f410c451 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -98,7 +98,7 @@ public:
return GetActiveWindow() == m_hwnd && GetForegroundWindow() == m_hwnd;
}
- CTabbedWindow *AddPage(MCONTACT hContact, wchar_t *pwszText = nullptr, int iActivate = -1);
+ CTabbedWindow *AddPage(MCONTACT hContact, wchar_t *pwszText = nullptr, int iNoActivate = -1);
CMsgDialog *CurrPage() const;
void AddPage(SESSION_INFO*, int insertAt = -1);