diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-14 20:42:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-14 20:42:27 +0000 |
commit | 579404053a550f96f01526579519fc4d581afe56 (patch) | |
tree | 1138bf39861042a939d68592696a450a42418b8b | |
parent | 31d7cf3e91487284771c10c4a83e9f2d01583aa3 (diff) |
fix for the event handles' clash
git-svn-id: http://svn.miranda-ng.org/main/trunk@7657 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_chat_int.h | 13 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 4 | ||||
-rw-r--r-- | src/core/stdchat/src/tools.cpp | 8 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 153 | ||||
-rw-r--r-- | src/modules/chat/chat.h | 1 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 9 | ||||
-rw-r--r-- | src/modules/chat/tools.cpp | 2 |
7 files changed, 88 insertions, 102 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 503c60d4e2..87f040ea48 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -403,12 +403,13 @@ struct CHAT_MANAGER // data
GlobalLogSettingsBase *pSettings;
- HIMAGELIST hImageList, hIconsList;
- HICON hIcons[30];
- FONTINFO aFonts[OPTIONS_FONTCOUNT];
- TCHAR *szActiveWndID;
- char *szActiveWndModule;
- int logPixelSY, logPixelSX;
+ HIMAGELIST hImageList, hIconsList;
+ HANDLE hBuildMenuEvent, hSendEvent;
+ HICON hIcons[30];
+ FONTINFO aFonts[OPTIONS_FONTCOUNT];
+ TCHAR *szActiveWndID;
+ char *szActiveWndModule;
+ int logPixelSY, logPixelSX;
};
extern CHAT_MANAGER ci, *pci;
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index fbd8bd8d3b..332dd99892 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h"
-//globals
+// globals
CLIST_INTERFACE *pcli;
CHAT_MANAGER *pci;
@@ -38,8 +38,6 @@ BOOL PopupInstalled = FALSE; HBRUSH hListBkgBrush = NULL;
HBRUSH hListSelectedBkgBrush = NULL;
-HANDLE hBuildMenuEvent, hSendEvent;
-
GlobalLogSettings g_Settings;
/* Missing MinGW GUIDs */
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 57aca9d6d3..f11b72bb80 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -22,9 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h"
-extern HMENU g_hMenu;
-extern HANDLE hBuildMenuEvent ;
-extern HANDLE hSendEvent;
+extern HMENU g_hMenu;
int GetRichTextLength(HWND hwnd)
{
@@ -554,7 +552,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO gcmi.Type = MENU_ON_NICKLIST;
}
- NotifyEventHooks(hBuildMenuEvent, 0, (WPARAM)&gcmi);
+ NotifyEventHooks(pci->hBuildMenuEvent, 0, (WPARAM)&gcmi);
if (gcmi.nItems > 0)
AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
@@ -631,7 +629,7 @@ BOOL DoEventHook(const TCHAR *pszID, const char* pszModule, int iType, const TCH gch.ptszText = (LPTSTR)pszText;
gch.dwData = dwItem;
gch.pDest = &gcd;
- NotifyEventHooks(hSendEvent, 0, (WPARAM)&gch);
+ NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)&gch);
return TRUE;
}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 0eba9abf26..43acff755e 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern TABLIST *g_TabList;
extern HBRUSH hListBkgBrush, hListSelectedBkgBrush;
-extern HANDLE hSendEvent;
extern CREOleCallback reOleCallback;
extern HMENU g_hMenu;
extern BOOL SmileyAddInstalled;
@@ -1811,31 +1810,27 @@ END_REMOVETAB: {
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
if (mis->CtlType == ODT_MENU)
- {
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- } else
- {
- int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
- int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
- int font = ih > ih2?ih:ih2;
- int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
- // make sure we have space for icon!
- if (g_Settings.ShowContactStatus)
- font = font > 16 ? font : 16;
+ int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
+ int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
+ int font = ih > ih2?ih:ih2;
+ int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
- mis->itemHeight = height > font?height:font;
- }
- return TRUE;
+ // make sure we have space for icon!
+ if (g_Settings.ShowContactStatus)
+ font = font > 16 ? font : 16;
+
+ mis->itemHeight = height > font?height:font;
}
+ return TRUE;
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU)
- {
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- } else
+
if (dis->CtlID == IDC_LIST) {
HFONT hFont, hOldFont;
HICON hIcon;
@@ -1881,15 +1876,15 @@ END_REMOVETAB: TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
- if (si->pAccPropServicesForNickList)
- {
+ if (si->pAccPropServicesForNickList) {
wchar_t *nick = mir_t2u(ui->pszNick);
si->pAccPropServicesForNickList->SetHwndPropStr(GetDlgItem(hwndDlg,IDC_LIST), OBJID_CLIENT, dis->itemID+1, PROPID_ACC_NAME, nick);
mir_free(nick);
}
}
return TRUE;
- } }
+ }
+ }
case GC_UPDATENICKLIST:
{
@@ -1901,69 +1896,69 @@ END_REMOVETAB: break;
case GC_EVENT_CONTROL + WM_USER+500:
- {
- switch(wParam) {
- case SESSION_OFFLINE:
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
+ switch (wParam) {
+ case SESSION_OFFLINE:
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ return TRUE;
- case SESSION_ONLINE:
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- return TRUE;
+ case SESSION_ONLINE:
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ return TRUE;
- case WINDOW_HIDDEN:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case WINDOW_HIDDEN:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_CLEARLOG:
- SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
- return TRUE;
+ case WINDOW_CLEARLOG:
+ SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
+ return TRUE;
- case SESSION_TERMINATE:
- SendMessage(hwndDlg,GC_SAVEWNDPOS,0,0);
- if (db_get_b(NULL, "Chat", "SavePosition", 0)) {
- db_set_dw(si->hContact, "Chat", "roomx", si->iX);
- db_set_dw(si->hContact, "Chat", "roomy", si->iY);
- db_set_dw(si->hContact, "Chat", "roomwidth" , si->iWidth);
- db_set_dw(si->hContact, "Chat", "roomheight", si->iHeight);
- }
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
- si->wState &= ~STATE_TALK;
- db_set_w(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case SESSION_TERMINATE:
+ SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 0);
+ if (db_get_b(NULL, "Chat", "SavePosition", 0)) {
+ db_set_dw(si->hContact, "Chat", "roomx", si->iX);
+ db_set_dw(si->hContact, "Chat", "roomy", si->iY);
+ db_set_dw(si->hContact, "Chat", "roomwidth", si->iWidth);
+ db_set_dw(si->hContact, "Chat", "roomheight", si->iHeight);
+ }
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
+ si->wState &= ~STATE_TALK;
+ db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)0);
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_MINIMIZE:
- ShowWindow(hwndDlg, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MINIMIZE:
+ ShowWindow(hwndDlg, SW_MINIMIZE);
+ goto LABEL_SHOWWINDOW;
- case WINDOW_MAXIMIZE:
- ShowWindow(hwndDlg, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MAXIMIZE:
+ ShowWindow(hwndDlg, SW_MAXIMIZE);
+ goto LABEL_SHOWWINDOW;
- case SESSION_INITDONE:
- if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(hwndDlg))
- ShowWindow(hwndDlg, SW_NORMAL);
-LABEL_SHOWWINDOW:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
- ShowWindow(hwndDlg, SW_SHOW);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SetForegroundWindow(hwndDlg);
+ case SESSION_INITDONE:
+ if (db_get_b(NULL, "Chat", "PopupOnJoin", 0) != 0)
return TRUE;
- } }
+ // fall through
+ case WINDOW_VISIBLE:
+ if (IsIconic(hwndDlg))
+ ShowWindow(hwndDlg, SW_NORMAL);
+LABEL_SHOWWINDOW:
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SetForegroundWindow(hwndDlg);
+ return TRUE;
+ }
break;
case GC_SPLITTERMOVED:
- { POINT pt;
+ {
+ POINT pt;
RECT rc;
RECT rcLog;
BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg,IDC_SMILEY));
@@ -2010,7 +2005,7 @@ LABEL_SHOWWINDOW: case GC_FIREHOOK:
if (lParam) {
GCHOOK *gch = (GCHOOK *)lParam;
- NotifyEventHooks(hSendEvent, 0, (WPARAM)gch);
+ NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)gch);
if (gch->pDest) {
mir_free((void*)gch->pDest->ptszID);
mir_free((void*)gch->pDest->pszModule);
@@ -2038,12 +2033,11 @@ LABEL_SHOWWINDOW: case GC_SHOWCOLORCHOOSER:
{
- HWND ColorWindow;
- RECT rc;
- BOOL bFG = lParam == IDC_COLOR?TRUE:FALSE;
+ BOOL bFG = lParam == IDC_COLOR ? TRUE : FALSE;
COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
- GetWindowRect(GetDlgItem(hwndDlg, bFG?IDC_COLOR:IDC_BKGCOLOR), &rc);
+ RECT rc;
+ GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_COLOR : IDC_BKGCOLOR), &rc);
pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
pCC->pModule = pci->MM_FindModule(si->pszModule);
pCC->xPosition = rc.left+3;
@@ -2051,7 +2045,7 @@ LABEL_SHOWWINDOW: pCC->bForeground = bFG;
pCC->si = si;
- ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC);
}
break;
@@ -2124,14 +2118,11 @@ LABEL_SHOWWINDOW: case WM_NOTIFY:
{
- LPNMHDR pNmhdr;
-
- pNmhdr = (LPNMHDR)lParam;
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
switch (pNmhdr->code) {
case NM_RCLICK:
if (pNmhdr->idFrom == IDC_TAB ) {
int i = TabCtrl_GetCurSel(pNmhdr->hwndFrom);
-
if (i != -1) {
SESSION_INFO* s;
HMENU hSubMenu;
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 5b3b799d94..ec52412a5a 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -33,7 +33,6 @@ struct GCPTRS };
extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
-extern HANDLE hChatSendEvent;
extern BOOL PopupInstalled;
// log.c
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 4532c7030b..0157e0c181 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -27,7 +27,6 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM); #include "chat.h"
BOOL SmileyAddInstalled, PopupInstalled, IEviewInstalled;
-HANDLE hChatSendEvent, hBuildMenuEvent;
HGENMENU hJoinMenuItem, hLeaveMenuItem;
CRITICAL_SECTION cs;
@@ -611,8 +610,8 @@ void LoadChatModule(void) CreateServiceFunction("GChat/JoinChat", JoinChat);
CreateServiceFunction("GChat/LeaveChat", LeaveChat);
- hChatSendEvent = CreateHookableEvent(ME_GC_EVENT);
- hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU);
+ ci.hSendEvent = CreateHookableEvent(ME_GC_EVENT);
+ ci.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU);
bInited = true;
}
@@ -624,6 +623,6 @@ void UnloadChatModule(void) OptionsUnInit();
DeleteCriticalSection(&cs);
- DestroyHookableEvent(hChatSendEvent);
- DestroyHookableEvent(hBuildMenuEvent);
+ DestroyHookableEvent(ci.hSendEvent);
+ DestroyHookableEvent(ci.hBuildMenuEvent);
}
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index 216798a3a2..9c8de54419 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -703,7 +703,7 @@ BOOL DoEventHook(const TCHAR *pszID, const char* pszModule, int iType, const TCH gch.ptszText = (LPTSTR)pszText;
gch.dwData = dwItem;
gch.pDest = &gcd;
- NotifyEventHooks(hChatSendEvent, 0, (WPARAM)&gch);
+ NotifyEventHooks(ci.hSendEvent, 0, (WPARAM)&gch);
return TRUE;
}
|