summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-28 14:18:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-28 14:18:31 +0300
commit6a9e3738066370dac38f5f6768b8a6f61fe709e0 (patch)
tree035d3b553c313505707f236e6c9c973416e1be65
parentb60c918dbcb16f4da7c35c15b190ee9def957a49 (diff)
SRMM notifications went to the core with ME_MSG_WINDOWEVENT
-rw-r--r--include/m_chat_int.h1
-rw-r--r--libs/win32/mir_app.libbin117574 -> 117884 bytes
-rw-r--r--libs/win64/mir_app.libbin113044 -> 113360 bytes
-rw-r--r--plugins/Scriver/src/chat_window.cpp8
-rw-r--r--plugins/Scriver/src/msgdialog.cpp24
-rw-r--r--plugins/Scriver/src/msgs.cpp54
-rw-r--r--plugins/Scriver/src/msgs.h2
-rw-r--r--plugins/Scriver/src/stdafx.h2
-rw-r--r--plugins/Scriver/src/tabs.cpp61
-rw-r--r--plugins/Scriver/src/tabs.h3
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp15
-rw-r--r--plugins/TabSRMM/src/globals.cpp5
-rw-r--r--plugins/TabSRMM/src/globals.h2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp14
-rw-r--r--plugins/TabSRMM/src/msgs.cpp30
-rw-r--r--plugins/TabSRMM/src/msgs.h12
-rw-r--r--src/core/stdmsg/src/chat_window.cpp10
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp25
-rw-r--r--src/core/stdmsg/src/stdafx.h3
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/srmm_base.cpp17
22 files changed, 113 insertions, 177 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 48a2efdf40..425e0c6573 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -419,6 +419,7 @@ protected:
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ int NotifyEvent(int code);
bool ProcessHotkeys(int key, bool bShift, bool bCtrl, bool bAlt);
void RefreshButtonStatus(void);
void RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 3f0764d855..ec5039b75a 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index af0c97dd46..ea68d5876f 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index d431f6a89b..970d78429a 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -211,7 +211,7 @@ void CChatRoomDlg::OnInitDialog()
CSuper::OnInitDialog();
m_si->pDlg = this;
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
@@ -265,12 +265,12 @@ void CChatRoomDlg::OnInitDialog()
SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)this, 0);
UpdateNickList();
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
}
void CChatRoomDlg::OnDestroy()
{
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
m_si->pDlg = nullptr;
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
@@ -284,7 +284,7 @@ void CChatRoomDlg::OnDestroy()
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
CSuper::OnDestroy();
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index e1e2e7525a..a798d00868 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -91,22 +91,6 @@ static wchar_t* GetQuotedTextW(wchar_t *text)
return out;
}
-void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
-{
- if (hContact == 0 || hwnd == nullptr)
- return;
-
- MessageWindowEventData mwe = { sizeof(mwe) };
- mwe.hContact = hContact;
- mwe.hwndWindow = hwnd;
- mwe.szModule = SRMM_MODULE;
- mwe.uType = type;
- mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwe.hwndInput = GetDlgItem(hwnd, IDC_SRMM_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_SRMM_LOG);
- NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe);
-}
-
int RTL_Detect(WCHAR *pszwText)
{
size_t iLen = mir_wstrlen(pszwText);
@@ -220,7 +204,7 @@ void CSrmmWindow::OnInitDialog()
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
WindowList_Add(pci->hWindowList, m_hwnd, m_hContact);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
m_szProto = GetContactProto(m_hContact);
@@ -413,12 +397,12 @@ void CSrmmWindow::OnInitDialog()
if (m_iMessagesInProgress > 0)
SendMessage(m_hwnd, DM_SHOWMESSAGESENDING, 0, 0);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
}
void CSrmmWindow::OnDestroy()
{
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
@@ -459,7 +443,7 @@ void CSrmmWindow::OnDestroy()
ieWindow.hwnd = m_hwndIeview;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
CSuper::OnDestroy();
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 90f5c36252..b6478dc16b 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
HCURSOR hDragCursor;
-HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite;
+HANDLE hHookWinPopup, hHookWinWrite;
HGENMENU hMsgMenuItem;
HMODULE hMsftEdit;
@@ -376,6 +376,56 @@ void CScriverWindow::LoadSettings()
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &m_clrInputFG);
}
+void CScriverWindow::Reattach(HWND hwndContainer)
+{
+ MCONTACT hContact = m_hContact;
+
+ POINT pt;
+ GetCursorPos(&pt);
+ HWND hParent = WindowFromPoint(pt);
+ while (GetParent(hParent) != nullptr)
+ hParent = GetParent(hParent);
+
+ hParent = WindowList_Find(g_dat.hParentWindowList, (UINT_PTR)hParent);
+ if ((hParent != nullptr && hParent != hwndContainer) || (hParent == nullptr && m_pParent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) {
+ if (hParent == nullptr) {
+ hParent = GetParentWindow(hContact, FALSE);
+
+ RECT rc;
+ GetWindowRect(hParent, &rc);
+
+ rc.right = (rc.right - rc.left);
+ rc.bottom = (rc.bottom - rc.top);
+ rc.left = pt.x - rc.right / 2;
+ rc.top = pt.y - rc.bottom / 2;
+ HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST);
+
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ GetMonitorInfo(hMonitor, &mi);
+
+ RECT rcDesktop = mi.rcWork;
+ if (rc.left < rcDesktop.left)
+ rc.left = rcDesktop.left;
+ if (rc.top < rcDesktop.top)
+ rc.top = rcDesktop.top;
+ MoveWindow(hParent, rc.left, rc.top, rc.right, rc.bottom, FALSE);
+ }
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
+ SetParent(hParent);
+ SendMessage(hwndContainer, CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
+ SendMessage(m_hwnd, DM_SETPARENT, 0, (LPARAM)hParent);
+ SendMessage(hParent, CM_ADDCHILD, (WPARAM)this, 0);
+ SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
+ SendMessage(hParent, CM_ACTIVATECHILD, 0, (LPARAM)m_hwnd);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
+ ShowWindow(hParent, SW_SHOWNA);
+ EnableWindow(hParent, TRUE);
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// status icons processing
@@ -592,7 +642,6 @@ int OnUnloadModule(void)
{
DestroyCursor(hDragCursor);
- DestroyHookableEvent(hHookWinEvt);
DestroyHookableEvent(hHookWinPopup);
DestroyHookableEvent(hHookWinWrite);
@@ -639,7 +688,6 @@ int OnLoadModule(void)
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
- hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index 58c80d4d6a..935fdaa1dc 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -98,6 +98,8 @@ public:
virtual void CloseTab() override;
virtual void LoadSettings() override;
+ void Reattach(HWND hwndContainer);
+
ParentWindowData *m_pParent;
int m_minLogBoxHeight, m_minEditBoxHeight;
HWND m_hwndIeview;
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h
index 77a01e40a2..09d0124a84 100644
--- a/plugins/Scriver/src/stdafx.h
+++ b/plugins/Scriver/src/stdafx.h
@@ -91,7 +91,7 @@ extern HWND SM_FindWindowByContact(MCONTACT hContact);
extern HINSTANCE g_hInst;
extern HCURSOR hDragCursor;
extern ITaskbarList3 *pTaskbarInterface;
-extern HANDLE hHookWinPopup, hHookWinWrite, hHookWinEvt;
+extern HANDLE hHookWinPopup, hHookWinWrite;
void ChangeStatusIcons();
void LoadInfobarFonts();
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp
index 3b164494c6..7dbc4f7c91 100644
--- a/plugins/Scriver/src/tabs.cpp
+++ b/plugins/Scriver/src/tabs.cpp
@@ -429,55 +429,8 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
tci.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, dat->srcTab, &tci);
CScriverWindow *pDlg = (CScriverWindow*)tci.lParam;
- if (pDlg != nullptr) {
- HWND hChild = pDlg->GetHwnd();
- MCONTACT hContact = pDlg->m_hContact;
-
- POINT pt;
- GetCursorPos(&pt);
- HWND hParent = WindowFromPoint(pt);
- while (GetParent(hParent) != nullptr)
- hParent = GetParent(hParent);
-
- hParent = WindowList_Find(g_dat.hParentWindowList, (UINT_PTR)hParent);
- if ((hParent != nullptr && hParent != GetParent(hwnd)) || (hParent == nullptr && pDlg->m_pParent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) {
- if (hParent == nullptr) {
- hParent = GetParentWindow(hContact, FALSE);
-
- RECT rc;
- GetWindowRect(hParent, &rc);
-
- rc.right = (rc.right - rc.left);
- rc.bottom = (rc.bottom - rc.top);
- rc.left = pt.x - rc.right / 2;
- rc.top = pt.y - rc.bottom / 2;
- HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST);
-
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- GetMonitorInfo(hMonitor, &mi);
-
- RECT rcDesktop = mi.rcWork;
- if (rc.left < rcDesktop.left)
- rc.left = rcDesktop.left;
- if (rc.top < rcDesktop.top)
- rc.top = rcDesktop.top;
- MoveWindow(hParent, rc.left, rc.top, rc.right, rc.bottom, FALSE);
- }
- NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_CLOSING);
- NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_CLOSE);
- SetParent(hChild, hParent);
- SendMessage(GetParent(hwnd), CM_REMOVECHILD, 0, (LPARAM)hChild);
- SendMessage(hChild, DM_SETPARENT, 0, (LPARAM)hParent);
- SendMessage(hParent, CM_ADDCHILD, (WPARAM)pDlg, 0);
- SendMessage(hChild, DM_UPDATETABCONTROL, 0, 0);
- SendMessage(hParent, CM_ACTIVATECHILD, 0, (LPARAM)hChild);
- NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_OPENING);
- NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_OPEN);
- ShowWindow(hParent, SW_SHOWNA);
- EnableWindow(hParent, TRUE);
- }
- }
+ if (pDlg != nullptr)
+ pDlg->Reattach(GetParent(hwnd));
}
else {
dat->destTab = -1;
@@ -485,13 +438,13 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
}
else if (dat->srcTab >= 0 && g_dat.flags2 & SMF2_TABCLOSEBUTTON) {
- IMAGEINFO info;
- POINT pt;
- RECT rect;
int atTop = (GetWindowLongPtr(hwnd, GWL_STYLE) & TCS_BOTTOM) == 0;
+
+ RECT rect;
TabCtrl_GetItemRect(hwnd, dat->srcTab, &rect);
- pt.x = LOWORD(lParam);
- pt.y = HIWORD(lParam);
+
+ POINT pt = { LOWORD(lParam), HIWORD(lParam) };
+ IMAGEINFO info;
ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
rect.left = rect.right - (info.rcImage.right - info.rcImage.left) - 6;
if (!atTop)
diff --git a/plugins/Scriver/src/tabs.h b/plugins/Scriver/src/tabs.h
index bafb7c4518..9af8c6d786 100644
--- a/plugins/Scriver/src/tabs.h
+++ b/plugins/Scriver/src/tabs.h
@@ -84,7 +84,6 @@ struct TabControlData
HICON hIcon;
};
-HWND GetParentWindow(MCONTACT hContact, BOOL bChat);
-void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type);
+HWND GetParentWindow(MCONTACT hContact, BOOL bChat);
#endif
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 77574de5a7..d73ca8f181 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -527,7 +527,7 @@ void CChatRoomDlg::OnInitDialog()
m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
- FireEvent(MSG_WINDOW_EVT_OPENING, 0);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
m_log.SendMsg(EM_SETEVENTMASK, 0, m_log.SendMsg(EM_GETEVENTMASK, 0, 0) | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS);
m_log.SendMsg(EM_LIMITTEXT, 0x7FFFFFFF, 0);
@@ -572,7 +572,7 @@ void CChatRoomDlg::OnInitDialog()
ShowWindow(m_hwnd, SW_SHOW);
UpdateNickList();
m_pContainer->m_hwndActive = m_hwnd;
- FireEvent(MSG_WINDOW_EVT_OPEN, 0);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
}
void CChatRoomDlg::OnDestroy()
@@ -588,7 +588,7 @@ void CChatRoomDlg::OnDestroy()
m_si->pDlg = nullptr;
m_si = nullptr;
- FireEvent(MSG_WINDOW_EVT_CLOSING, 0);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
DM_FreeTheme();
@@ -617,7 +617,7 @@ void CChatRoomDlg::OnDestroy()
M.RemoveWindow(m_hwnd);
- FireEvent(MSG_WINDOW_EVT_CLOSE, 0);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
m_pContainer->ClearMargins();
PostMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1);
@@ -1312,11 +1312,10 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
}
return 0;
}
+
if (wParam != VK_RIGHT && wParam != VK_LEFT) {
- mir_free(m_wszSearchQuery);
- m_wszSearchQuery = nullptr;
- mir_free(m_wszSearchResult);
- m_wszSearchResult = nullptr;
+ replaceStrW(m_wszSearchQuery, nullptr);
+ replaceStrW(m_wszSearchResult, nullptr);
}
if (wParam == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab)
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 64b280b13e..9fd2aa5151 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -297,15 +297,13 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM)
if (M.GetByte("avatarmode", -1) == -1)
db_set_b(0, SRMSGMOD_T, "avatarmode", 2);
- PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP,
- 0, 0, 40, 40, 0, 0, g_hInst, nullptr);
+ PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, 0, 0, g_hInst, nullptr);
::CreateTrayMenus(TRUE);
if (nen_options.bTraySupport)
::CreateSystrayIcon(TRUE);
CMenuItem mi;
-
SET_UID(mi, 0x9f68b822, 0xff97, 0x477d, 0xb7, 0x6d, 0xa5, 0x59, 0x33, 0x1c, 0x54, 0x40);
mi.position = -500050005;
mi.hIcolibItem = PluginConfig.g_iconContainer;
@@ -468,7 +466,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM)
::SI_DeinitStatusIcons();
// the event API
- DestroyHookableEvent(PluginConfig.m_event_MsgWin);
DestroyHookableEvent(PluginConfig.m_event_MsgPopup);
DestroyHookableEvent(PluginConfig.m_event_WriteEvent);
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h
index 244a7f68f8..e73fb1f62a 100644
--- a/plugins/TabSRMM/src/globals.h
+++ b/plugins/TabSRMM/src/globals.h
@@ -136,7 +136,7 @@ public:
COLORREF m_ipBackgroundGradient;
COLORREF m_ipBackgroundGradientHigh;
COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor;
- HANDLE m_event_MsgWin, m_event_MsgPopup, m_event_WriteEvent;
+ HANDLE m_event_MsgPopup, m_event_WriteEvent;
HGENMENU m_hMenuItem;
BYTE m_useAeroPeek;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 8f73008fb2..8c856fbdc8 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -725,7 +725,7 @@ void CSrmmWindow::OnInitDialog()
SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
- FireEvent(MSG_WINDOW_EVT_OPENING);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
for (int i = 0; i < _countof(tooltips); i++)
SendDlgItemMessage(m_hwnd, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE);
@@ -858,7 +858,7 @@ void CSrmmWindow::OnInitDialog()
mir_subclassWindow(m_hwndHPP, HPPKFSubclassProc);
m_dwFlags &= ~MWF_INITMODE;
- FireEvent(MSG_WINDOW_EVT_OPEN);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
@@ -887,7 +887,7 @@ void CSrmmWindow::OnDestroy()
DestroyWindow(m_hwndPanelPicParent);
if (m_cache->isValid()) { // not valid means the contact was deleted
- FireEvent(MSG_WINDOW_EVT_CLOSING);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
AddContactToFavorites(m_hContact, m_cache->getNick(), m_cache->getActiveProto(), m_wszStatus, m_wStatus,
Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
if (m_hContact) {
@@ -946,7 +946,7 @@ void CSrmmWindow::OnDestroy()
m_iTabID = -1;
}
- FireEvent(MSG_WINDOW_EVT_CLOSE);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
// clean up IEView and H++ log windows
if (m_hwndIEView != 0) {
@@ -1168,12 +1168,6 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*)
DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
DeletePopupsForContact(m_hContact, PU_REMOVE_ON_SEND);
- if (M.GetByte("allow_sendhook", 0)) {
- int result = FireEvent(MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
- if (result)
- return;
- }
-
sendQueue->addTo(this, memRequired, flags);
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index a348800445..f9f02f9703 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -854,35 +854,6 @@ void TSAPI CreateImageList(BOOL bInitial)
PluginConfig.g_IconTypingEvent = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
}
-int CTabBaseDlg::FireEvent(unsigned int type, unsigned int subType)
-{
- if (m_hContact == 0 || m_hwnd == nullptr)
- return 0;
-
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
- if (dat == nullptr)
- return 0;
-
- MessageWindowEventData mwe = { sizeof(mwe) };
- mwe.hContact = m_hContact;
- mwe.hwndWindow = m_hwnd;
- mwe.szModule = "tabSRMsgW";
- mwe.uType = type;
- mwe.hwndInput = m_message.GetHwnd();
- mwe.hwndLog = m_log.GetHwnd();
-
- if (type == MSG_WINDOW_EVT_CUSTOM) {
- TABSRMM_SessionInfo se = { sizeof(se) };
- se.evtCode = HIWORD(subType);
- se.hwnd = m_hwnd;
- se.extraFlags = (unsigned int)(LOWORD(subType));
- se.local = dat->m_sendBuffer;
- mwe.local = &se;
- }
-
- return NotifyEventHooks(PluginConfig.m_event_MsgWin, 0, (LPARAM)&mwe);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// standard icon definitions
@@ -1142,7 +1113,6 @@ static void TSAPI InitAPI()
CB_InitCustomButtons();
// the event API
- PluginConfig.m_event_MsgWin = CreateHookableEvent(ME_MSG_WINDOWEVENT);
PluginConfig.m_event_MsgPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
PluginConfig.m_event_WriteEvent = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 1b3c4987d3..5ab3b1e144 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -252,7 +252,6 @@ protected:
void DetermineMinHeight();
void FindFirstEvent();
- int FireEvent(unsigned int type, unsigned int subType = 0);
void GetSendFormat();
bool IsAutoSplitEnabled() const;
void ResizeIeView();
@@ -1002,17 +1001,6 @@ struct SIDEBARITEM {
#include "templates.h"
-struct TABSRMM_SessionInfo {
- unsigned int cbSize;
- unsigned short evtCode;
- HWND hwnd; // handle of the message dialog (tab)
- HWND hwndContainer; // handle of the parent container
- HWND hwndInput; // handle of the input area (rich edit)
- UINT extraFlags;
- UINT extraFlagsEX;
- void *local;
-};
-
// callback for the user menu entry
#define MS_TABMSG_SETUSERPREFS "SRMsg_MOD/SetUserPrefs"
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 51f5ab8a98..5ba99792bb 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -64,7 +64,7 @@ void CChatRoomDlg::OnInitDialog()
WindowList_Add(pci->hWindowList, m_hwnd, m_hContact);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
@@ -89,12 +89,12 @@ void CChatRoomDlg::OnInitDialog()
SendMessage(m_hwnd, WM_SIZE, 0, 0);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
}
void CChatRoomDlg::OnDestroy()
{
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
SaveWindowPosition(true);
if (!g_Settings.bTabsEnable) {
@@ -112,7 +112,7 @@ void CChatRoomDlg::OnDestroy()
m_si->wState &= ~STATE_TALK;
DestroyWindow(m_hwndStatus); m_hwndStatus = nullptr;
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
CSuper::OnDestroy();
}
@@ -764,7 +764,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
if (ProcessHotkeys(wParam, isShift, isCtrl, isAlt))
return TRUE;
- if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (paste clean text)
+ if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (toggle filter)
onClick_Filter(&m_btnFilter);
return TRUE;
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 71ec207848..689916ccfb 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -35,22 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static const UINT sendControls[] = { IDC_SRMM_MESSAGE };
-void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
-{
- if (hContact != NULL && hwnd != NULL) {
- MessageWindowEventData mwe = {};
- mwe.cbSize = sizeof(mwe);
- mwe.hContact = hContact;
- mwe.hwndWindow = hwnd;
- mwe.szModule = SRMMMOD;
- mwe.uType = type;
- mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- mwe.hwndInput = GetDlgItem(hwnd, IDC_SRMM_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_SRMM_LOG);
- NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe);
- }
-}
-
static int RTL_Detect(const wchar_t *ptszText)
{
int iLen = (int)mir_wstrlen(ptszText);
@@ -141,7 +125,7 @@ void CSrmmWindow::OnInitDialog()
m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY);
m_wMinute = 61;
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
+ NotifyEvent(MSG_WINDOW_EVT_OPENING);
if (m_wszInitialText) {
m_message.SetText(m_wszInitialText);
@@ -298,13 +282,13 @@ void CSrmmWindow::OnInitDialog()
}
SendMessage(m_hwnd, DM_GETAVATAR, 0, 0);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+ NotifyEvent(MSG_WINDOW_EVT_OPEN);
}
void CSrmmWindow::OnDestroy()
{
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSING);
// save string from the editor
if (m_hContact) {
@@ -346,7 +330,7 @@ void CSrmmWindow::OnDestroy()
db_set_dw(hContact, SRMMMOD, "width", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
db_set_dw(hContact, SRMMMOD, "height", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
+ NotifyEvent(MSG_WINDOW_EVT_CLOSE);
if (m_hContact && g_dat.bDeleteTempCont)
if (db_get_b(m_hContact, "CList", "NotOnList", 0))
db_delete_contact(m_hContact);
@@ -741,7 +725,6 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
static const CHARRANGE all = { 0, -1 };
MessageWindowPopupData mwpd = {};
- mwpd.cbSize = sizeof(mwpd);
mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
mwpd.uFlags = MSG_WINDOWPOPUP_INPUT;
mwpd.hContact = m_hContact;
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 7d7e196839..b97132d10e 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -81,7 +81,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GC_SWITCHTAB (WM_USER+0x106)
extern HINSTANCE g_hInst;
-extern HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite;
+extern HANDLE hHookWinPopup, hHookWinWrite;
extern CREOleCallback reOleCallback;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -150,7 +150,6 @@ int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, bool bHide);
// message.cpp
char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si);
-void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type);
// tabs.cpp
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 9e7da2d190..8b65c2bcb6 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -444,3 +444,4 @@ _stubLogProc@16 @446 NONAME
_stubMessageProc@16 @447 NONAME
_stubNicklistProc@16 @448 NONAME
Chat_GetTextPixelSize @449 NONAME
+?NotifyEvent@CSrmmBaseDialog@@IAEHH@Z @450 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index fd8431c520..856beb7707 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -444,3 +444,4 @@ stubLogProc @446 NONAME
stubMessageProc @447 NONAME
stubNicklistProc @448 NONAME
Chat_GetTextPixelSize @449 NONAME
+?NotifyEvent@CSrmmBaseDialog@@IEAAHH@Z @450 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 01b401f1f2..9543f2e1e5 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -812,6 +812,23 @@ void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList)
/////////////////////////////////////////////////////////////////////////////////////////
+extern HANDLE hHookSrmmEvent;
+
+int CSrmmBaseDialog::NotifyEvent(int code)
+{
+ if (m_hContact == 0 && m_hwnd == nullptr)
+ return -1;
+
+ MessageWindowEventData mwe = {};
+ mwe.hContact = m_hContact;
+ mwe.hwndWindow = m_hwnd;
+ mwe.uType = code;
+ mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
+ mwe.hwndInput = m_message.GetHwnd();
+ mwe.hwndLog = m_log.GetHwnd();
+ return ::NotifyEventHooks(hHookSrmmEvent, 0, (LPARAM)&mwe);
+}
+
bool CSrmmBaseDialog::ProcessHotkeys(int key, bool isShift, bool isCtrl, bool isAlt)
{
// Esc (close tab)