summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-04-04 00:20:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-04-04 00:20:24 +0300
commit5c3ab50ab27ba9a517cf56d0626c641883e3fd39 (patch)
tree553f38fa4a7673d710ee18f570201d177e2f64ac /src/mir_app
parent7f513673b523ecfbf6ded0a2d0e5cdf5496bd6b0 (diff)
SRMM window list completely incapsulated into mir_app to avoid corrupting it by someone's dirty hands
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/chat.h1
-rw-r--r--src/mir_app/src/chat_svc.cpp7
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/srmm_base.cpp4
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp17
-rw-r--r--src/mir_app/src/srmm_util.cpp11
7 files changed, 30 insertions, 14 deletions
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 5f408fb215..fca1458400 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -42,6 +42,7 @@ extern HMENU g_hMenu;
extern HCURSOR g_hCurHyperlinkHand;
extern char* pLogIconBmpBits[14];
extern LIST<SESSION_INFO> g_arSessions;
+extern MWindowList g_hWindowList;
// log.c
void LoadMsgLogBitmaps(void);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 1dd20900a8..002742a66c 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -27,9 +27,10 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM);
#include "chat.h"
#include "resource.h"
+mir_cs csChat;
HMENU g_hMenu = nullptr;
HGENMENU hJoinMenuItem, hLeaveMenuItem;
-mir_cs csChat;
+MWindowList g_hWindowList;
static HANDLE
hServiceRegister = nullptr,
@@ -777,7 +778,7 @@ int LoadChatModule(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
- chatApi.hWindowList = WindowList_Create();
+ g_hWindowList = WindowList_Create();
chatApi.hSendEvent = CreateHookableEvent(ME_GC_EVENT);
chatApi.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU);
hHookEvent = CreateHookableEvent(ME_GC_HOOK_EVENT);
@@ -803,7 +804,7 @@ void UnloadChatModule(void)
FreeMsgLogBitmaps();
OptionsUnInit();
- WindowList_Destroy(chatApi.hWindowList);
+ WindowList_Destroy(g_hWindowList);
DestroyHookableEvent(chatApi.hSendEvent);
DestroyHookableEvent(chatApi.hBuildMenuEvent);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 67645af6f5..156ea679c2 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -446,3 +446,5 @@ _stubNicklistProc@16 @448 NONAME
Chat_GetTextPixelSize @449 NONAME
?NotifyEvent@CSrmmBaseDialog@@IAEHH@Z @450 NONAME
Srmm_GetWindowData @451
+Srmm_FindWindow @452
+Srmm_Broadcast @453
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 563b920ab4..11b740223e 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -446,3 +446,5 @@ stubNicklistProc @448 NONAME
Chat_GetTextPixelSize @449 NONAME
?NotifyEvent@CSrmmBaseDialog@@IEAAHH@Z @450 NONAME
Srmm_GetWindowData @451
+Srmm_FindWindow @452
+Srmm_Broadcast @453
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 62d744f540..0bf810aa5f 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -577,7 +577,7 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam
void CSrmmBaseDialog::OnInitDialog()
{
- WindowList_Add(chatApi.hWindowList, m_hwnd, m_hContact);
+ WindowList_Add(g_hWindowList, m_hwnd, m_hContact);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
SetWindowLongPtr(m_log.GetHwnd(), GWLP_USERDATA, LPARAM(this));
@@ -598,7 +598,7 @@ void CSrmmBaseDialog::OnInitDialog()
void CSrmmBaseDialog::OnDestroy()
{
- WindowList_Remove(chatApi.hWindowList, m_hwnd);
+ WindowList_Remove(g_hWindowList, m_hwnd);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
mir_unsubclassWindow(m_log.GetHwnd(), stubLogProc);
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 8517637822..1469628d70 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
+#include "chat.h"
#define MODULENAME "SRMM_Toolbar"
@@ -148,7 +149,7 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang)
if (cbd->m_dwArrowCID == LastCID)
LastCID++;
- WindowList_Broadcast(chatApi.hWindowList, WM_CBD_UPDATED, 0, 0);
+ WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, 0);
return 0;
}
@@ -190,7 +191,7 @@ MIR_APP_DLL(int) Srmm_SetButtonState(MCONTACT hContact, BBButton *bbdi)
if (!tempCID)
return 1;
- HWND hwndDlg = WindowList_Find(chatApi.hWindowList, hContact);
+ HWND hwndDlg = WindowList_Find(g_hWindowList, hContact);
if (hwndDlg == nullptr)
return 1;
@@ -231,7 +232,7 @@ MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi)
}
if (pFound) {
- WindowList_Broadcast(chatApi.hWindowList, WM_CBD_REMOVED, pFound->m_dwButtonCID, (LPARAM)pFound);
+ WindowList_Broadcast(g_hWindowList, WM_CBD_REMOVED, pFound->m_dwButtonCID, (LPARAM)pFound);
delete pFound;
}
return 0;
@@ -272,7 +273,7 @@ MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi)
}
if (bFound)
- WindowList_Broadcast(chatApi.hWindowList, WM_CBD_UPDATED, 0, (LPARAM)cbd);
+ WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, (LPARAM)cbd);
return 0;
}
@@ -403,8 +404,8 @@ static void CB_ReInitCustomButtons()
}
qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons);
- WindowList_Broadcast(chatApi.hWindowList, WM_CBD_UPDATED, 0, 0);
- WindowList_Broadcast(chatApi.hWindowList, WM_CBD_LOADICONS, 0, 0);
+ WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, 0);
+ WindowList_Broadcast(g_hWindowList, WM_CBD_LOADICONS, 0, 0);
}
static void CB_WriteButtonSettings(MCONTACT hContact, CustomButtonData *cbd)
@@ -618,7 +619,7 @@ public:
WORD newGap = m_gap.GetPosition();
if (newGap != db_get_b(0, MODULENAME, "ButtonsBarGap", 1)) {
- WindowList_BroadcastAsync(chatApi.hWindowList, WM_SIZE, 0, 0);
+ WindowList_BroadcastAsync(g_hWindowList, WM_SIZE, 0, 0);
db_set_b(0, MODULENAME, "ButtonsBarGap", newGap);
}
@@ -638,7 +639,7 @@ public:
void btnResetClicked(void*)
{
db_delete_module(0, MODULENAME);
- WindowList_Broadcast(chatApi.hWindowList, WM_CBD_REMOVED, 0, 0);
+ WindowList_Broadcast(g_hWindowList, WM_CBD_REMOVED, 0, 0);
Srmm_ResetToolbar();
NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0);
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp
index 482e3c3fb0..864f8ca00f 100644
--- a/src/mir_app/src/srmm_util.cpp
+++ b/src/mir_app/src/srmm_util.cpp
@@ -78,7 +78,7 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd)
if (hContact == 0)
return 1;
- HWND hwnd = WindowList_Find(chatApi.hWindowList, hContact);
+ HWND hwnd = WindowList_Find(g_hWindowList, hContact);
if (hwnd == nullptr)
return 1;
@@ -94,3 +94,12 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd)
return 0;
}
+MIR_APP_DLL(void) Srmm_Broadcast(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WindowList_Broadcast(g_hWindowList, msg, wParam, lParam);
+}
+
+MIR_APP_DLL(HWND) Srmm_FindWindow(MCONTACT hContact)
+{
+ return WindowList_Find(g_hWindowList, hContact);
+}