diff options
author | George Hazan <george.hazan@gmail.com> | 2014-12-05 15:06:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-12-05 15:06:15 +0000 |
commit | 7c3775ae24f772f37ee69632f11292bd59ebccd2 (patch) | |
tree | 2f8fa62167b13207986f564cea10e12f3d0f5939 | |
parent | ae10177eb1e515eada4aa2b4295aab02d1f7c176 (diff) |
useless function removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@11252 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/delphi/m_clistint.inc | 37 | ||||
-rw-r--r-- | include/m_clistint.h | 6 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clisttray.cpp | 6 | ||||
-rw-r--r-- | src/modules/clist/clc.h | 4 | ||||
-rw-r--r-- | src/modules/clist/clistcore.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clistevents.cpp | 129 | ||||
-rw-r--r-- | src/modules/clist/clisttray.cpp | 36 |
7 files changed, 97 insertions, 123 deletions
diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index c3efe4d858..5645c0e45d 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -493,8 +493,7 @@ type pfnStub2 : function (_para1:int):int; cdecl;
pfnGetProtocolVisibility : function (_para1:PAnsiChar):int; cdecl;
- pfnGetProtoIndexByPos : function (var proto:PPROTOCOLDESCRIPTOR;
- protoCnt:int; Pos:int):int; cdecl;
+ pfnGetProtoIndexByPos : function (var proto:PPROTOCOLDESCRIPTOR; protoCnt:int; Pos:int):int; cdecl;
pfnReloadProtoMenus : procedure ; cdecl;
(*************************************************************************************
@@ -509,26 +508,21 @@ type szTip : TChar;
bTrayMenuOnScreen : bool;
- pfnGetIconFromStatusMode : function (hContact:TMCONTACT; szProto:PAnsiChar;
- status:int):HICON; cdecl;
+ pfnGetIconFromStatusMode : function (hContact:TMCONTACT; szProto:PAnsiChar; status:int):HICON; cdecl;
pfnInitTray : procedure ; cdecl;
- pfnTrayIconAdd : function (hwnd:HWND; szProto:PAnsiChar; szIconProto:PAnsiChar;
- status:int):int; cdecl;
+ pfnUninitTray : procedure ; cdecl;
+
+ pfnTrayIconAdd : function (hwnd:HWND; szProto:PAnsiChar; szIconProto:PAnsiChar; status:int):int; cdecl;
pfnTrayIconDestroy : function (hwnd:HWND):int; cdecl;
pfnTrayIconInit : function (hwnd:HWND):int; cdecl;
pfnTrayIconMakeTooltip : function (szPrefix:TChar; szProto:PAnsiChar):TChar; cdecl;
pfnTrayIconRemove : procedure (hwnd:HWND; szProto:PAnsiChar); cdecl;
pfnTrayIconSetBaseInfo : function (hIcon:HICON; szPreferredProto:PAnsiChar):int; cdecl;
pfnTrayIconTaskbarCreated : procedure (hwnd:HWND); cdecl;
- pfnTrayIconUpdate : function (hNewIcon:HICON; szNewTip:TChar;
- szPreferredProto:PAnsiChar; isBase:int):int; cdecl;
-
- pfnUninitTray : procedure ; cdecl;
- pfnLockTray : procedure ; cdecl;
- pfnUnlockTray : procedure ; cdecl;
+ pfnTrayIconUpdate : function (hNewIcon:HICON; szNewTip:TChar; szPreferredProto:PAnsiChar; isBase:int):int; cdecl;
- pfnTrayCycleTimerProc : procedure(hwnd:HWND;message:uint;idEvent:uint_ptr;dwTime:dword); stdcall;
+ pfnTrayCycleTimerProc : procedure(hwnd:HWND; message:uint; idEvent:uint_ptr; dwTime:dword); stdcall;
(*************************************************************************************
* version 6 additions (0.8.0.x) - accounts
@@ -536,18 +530,17 @@ type pfnGetAccountIndexByPos : function (pos:int):int; cdecl;
pfnConvertMenu: function( clitem:PCLISTMENUITEM; moitem:PMO_MenuItem):int; cdecl;
- (*************************************************************************************
- * version 7 additions (0.11.0.x) - extra images
- *************************************************************************************)
+ (*************************************************************************************
+ * version 7 additions (0.11.0.x) - extra images
+ *************************************************************************************)
pfnReloadExtraIcons: procedure; cdecl;
pfnSetAllExtraIcons: procedure(hContact:TMCONTACT); cdecl;
- (*************************************************************************************
- * Miranda NG additions
- *************************************************************************************)
-
- pfnGetContactIcon: function(hContact:TMCONTACT):int; cdecl;
- pfnTrayCalcChanged:function(szChangedProto:PAnsiChar; averageMode:int; iProtoCount:int):int; cdecl;
+ (*************************************************************************************
+ * Miranda NG additions
+ *************************************************************************************)
+ pfnGetContactIcon: function(hContact:TMCONTACT):int; cdecl;
+ pfnTrayCalcChanged:function(szChangedProto:PAnsiChar; averageMode:int; iProtoCount:int):int; cdecl;
pfnGetAverageMode:function(pNetProtoCount:pint):int; cdecl;
pfnInitAutoRebuild:procedure(hwnd:HWND); cdecl;
end;
diff --git a/include/m_clistint.h b/include/m_clistint.h index 25a124d42e..b430c06324 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -446,6 +446,8 @@ typedef struct HICON (*pfnGetIconFromStatusMode)(MCONTACT hContact, const char *szProto, int status);
void (*pfnInitTray)(void);
+ void (*pfnUninitTray)(void);
+
int (*pfnTrayIconAdd)(HWND hwnd, const char *szProto, const char *szIconProto, int status);
int (*pfnTrayIconDestroy)(HWND hwnd);
int (*pfnTrayIconInit)(HWND hwnd);
@@ -455,10 +457,6 @@ typedef struct void (*pfnTrayIconTaskbarCreated)(HWND hwnd);
int (*pfnTrayIconUpdate)(HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase);
- void (*pfnUninitTray)(void);
- void (*pfnLockTray)(void);
- void (*pfnUnlockTray)(void);
-
VOID (CALLBACK *pfnTrayCycleTimerProc)(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
/*************************************************************************************
diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 00a3de8eaa..75fafbc18e 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -84,14 +84,14 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou case SETTING_TRAYICON_SINGLE:
ptrA szProto( db_get_sa(NULL, "CList", "PrimaryStatus"));
- int iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon);
+ iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
}
}
}
else {
- int iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);
+ iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);
hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL);
return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
}
@@ -106,7 +106,7 @@ INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) MSG *msg = (MSG*)wParam;
if (msg->message == TIM_CALLBACK && msg->lParam == WM_MOUSEMOVE ) {
if (cfg::dat.bNoTrayTips) {
- *((LRESULT *)lParam) = 0;
+ *((LRESULT*)lParam) = 0;
return TRUE;
}
}
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 35c3a4b004..19002bdf59 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -157,10 +157,10 @@ TCHAR* fnGetStatusModeDescription(int wParam, int lParam); int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY);
/* clisttray.c */
+extern mir_cs trayLockCS;
+
void fnInitTray(void);
void fnUninitTray(void);
-void fnLockTray(void);
-void fnUnlockTray(void);
int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY *msn);
int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status);
int fnTrayIconDestroy(HWND hwnd);
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index 156f1149f7..b5970a7627 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -154,8 +154,6 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM) cli.szTip = szTip;
cli.pfnInitTray = fnInitTray;
cli.pfnUninitTray = fnUninitTray;
- cli.pfnLockTray = fnLockTray;
- cli.pfnUnlockTray = fnUnlockTray;
cli.pfnTrayCycleTimerProc = fnTrayCycleTimerProc;
cli.pfnTrayIconAdd = fnTrayIconAdd;
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 92397503c9..7968fb4a43 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -89,13 +89,12 @@ static void ShowEventsInTray() // in case if we have several icons in tray and several events with different protocols
// lets use several icon to show events from protocols in different icons
- cli.pfnLockTray();
+ mir_cslock lck(trayLockCS);
char **pTrayProtos = (char**)_alloca(sizeof(char*)*cli.trayIconCount);
int nTrayProtoCnt = 0;
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0 || !cli.trayIcon[i].szProto) continue;
- pTrayProtos[nTrayProtoCnt++] = cli.trayIcon[i].szProto;
- }
+ for (int i = 0; i < cli.trayIconCount; i++)
+ if (cli.trayIcon[i].id != 0 && cli.trayIcon[i].szProto)
+ pTrayProtos[nTrayProtoCnt++] = cli.trayIcon[i].szProto;
for (int i = 0; i < cli.events.count; i++) {
char *iEventProto = GetEventProtocol(i);
@@ -110,7 +109,6 @@ static void ShowEventsInTray() ShowOneEventInTray(i); // show it
pTrayProtos[j] = NULL; // and clear slot
}
- cli.pfnUnlockTray();
}
static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
@@ -255,7 +253,7 @@ CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx) int fnEventsProcessContactDoubleClick(MCONTACT hContact)
{
- for (int i=0; i < cli.events.count; i++) {
+ for (int i = 0; i < cli.events.count; i++) {
if (cli.events.items[i]->cle.hContact == hContact) {
HANDLE hDbEvent = cli.events.items[i]->cle.hDbEvent;
CallService(cli.events.items[i]->cle.pszService, (WPARAM)(HWND)NULL, (LPARAM)& cli.events.items[i]->cle);
@@ -270,72 +268,73 @@ int fnEventsProcessContactDoubleClick(MCONTACT hContact) int fnEventsProcessTrayDoubleClick(int index)
{
BOOL click_in_first_icon = FALSE;
- if (cli.events.count) {
- MCONTACT hContact;
- HANDLE hDbEvent;
- int eventIndex = 0;
- cli.pfnLockTray();
- if (cli.trayIconCount > 1 && index > 0) {
- int i;
- char *szProto = NULL;
- for (i = 0; i < cli.trayIconCount; i++)
- if (cli.trayIcon[i].id == index) {
- szProto = cli.trayIcon[i].szProto;
- if (i == 0) click_in_first_icon = TRUE;
+ if (cli.events.count == 0)
+ return 1;
+
+ int eventIndex = 0;
+
+ mir_cslockfull lck(trayLockCS);
+ if (cli.trayIconCount > 1 && index > 0) {
+ int i;
+ char *szProto = NULL;
+ for (i = 0; i < cli.trayIconCount; i++) {
+ if (cli.trayIcon[i].id == index) {
+ szProto = cli.trayIcon[i].szProto;
+ if (i == 0)
+ click_in_first_icon = TRUE;
+ break;
+ }
+ }
+ if (szProto) {
+ for (i = 0; i < cli.events.count; i++) {
+ char *eventProto = NULL;
+ if (cli.events.items[i]->cle.hContact)
+ eventProto = GetContactProto(cli.events.items[i]->cle.hContact);
+ if (!eventProto)
+ eventProto = cli.events.items[i]->cle.lpszProtocol;
+
+ if (!eventProto || !_strcmpi(eventProto, szProto)) {
+ eventIndex = i;
break;
}
- if (szProto) {
- for (i = 0; i < cli.events.count; i++) {
- char * eventProto = NULL;
- if (cli.events.items[i]->cle.hContact)
- eventProto = GetContactProto(cli.events.items[i]->cle.hContact);
- if (!eventProto)
- eventProto = cli.events.items[i]->cle.lpszProtocol;
-
- if (!eventProto || !_strcmpi(eventProto, szProto)) {
- eventIndex = i;
- break;
- }
- }
+ }
- if (i == cli.events.count) { //EventNotFound
- //lets process backward try to find first event without desired proto in tray
- int j;
- if (click_in_first_icon)
- for (i = 0; i < cli.events.count; i++) {
- char *eventProto = NULL;
- if (cli.events.items[i]->cle.hContact)
- eventProto = GetContactProto(cli.events.items[i]->cle.hContact);
- if (!eventProto)
- eventProto = cli.events.items[i]->cle.lpszProtocol;
- if (eventProto) {
- for (j = 0; j < cli.trayIconCount; j++)
- if (cli.trayIcon[j].szProto && !_strcmpi(eventProto, cli.trayIcon[j].szProto))
- break;
-
- if (j == cli.trayIconCount) {
- eventIndex = i;
- break;
- }
- }
+ // let's process backward try to find first event without desired proto in tray
+ if (i == cli.events.count) {
+ if (click_in_first_icon) {
+ for (i = 0; i < cli.events.count; i++) {
+ char *eventProto = NULL;
+ if (cli.events.items[i]->cle.hContact)
+ eventProto = GetContactProto(cli.events.items[i]->cle.hContact);
+ if (!eventProto)
+ eventProto = cli.events.items[i]->cle.lpszProtocol;
+ if (!eventProto)
+ continue;
+
+ int j;
+ for (j = 0; j < cli.trayIconCount; j++)
+ if (cli.trayIcon[j].szProto && !_strcmpi(eventProto, cli.trayIcon[j].szProto))
+ break;
+
+ if (j == cli.trayIconCount) {
+ eventIndex = i;
+ break;
}
- if (i == cli.events.count) { //not found
- cli.pfnUnlockTray();
- return 1; //continue processing to show contact list
}
}
+ if (i == cli.events.count) //not found
+ return 1; //continue processing to show contact list
}
}
-
- cli.pfnUnlockTray();
- hContact = cli.events.items[eventIndex]->cle.hContact;
- hDbEvent = cli.events.items[eventIndex]->cle.hDbEvent;
- // ; may be better to show send msg?
- CallService(cli.events.items[eventIndex]->cle.pszService, (WPARAM)NULL, (LPARAM)& cli.events.items[eventIndex]->cle);
- cli.pfnRemoveEvent(hContact, hDbEvent);
- return 0;
}
- return 1;
+ lck.unlock();
+
+ MCONTACT hContact = cli.events.items[eventIndex]->cle.hContact;
+ HANDLE hDbEvent = cli.events.items[eventIndex]->cle.hDbEvent;
+ // ; may be better to show send msg?
+ CallService(cli.events.items[eventIndex]->cle.pszService, 0, (LPARAM)& cli.events.items[eventIndex]->cle);
+ cli.pfnRemoveEvent(hContact, hDbEvent);
+ return 0;
}
static int RemoveEventsForContact(WPARAM wParam, LPARAM)
@@ -403,7 +402,7 @@ CListEvent* fnCreateEvent(void) return (CListEvent*)mir_calloc(sizeof(CListEvent));
}
-void fnFreeEvent(CListEvent* p)
+void fnFreeEvent(CListEvent *p)
{
mir_free(p->cle.pszService);
mir_free(p->cle.pszTooltip);
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 2bfbb8906d..9144a1c694 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -33,7 +33,8 @@ static UINT WM_TASKBARCREATED; static UINT WM_TASKBARBUTTONCREATED;
static BOOL mToolTipTrayTips = FALSE;
static UINT_PTR RefreshTimerId = 0; /////by FYR
-static CRITICAL_SECTION trayLockCS;
+
+mir_cs trayLockCS;
// don't move to win2k.h, need new and old versions to work on 9x/2000/XP
#define NIF_STATE 0x00000008
@@ -47,18 +48,16 @@ static BOOL fTrayInited = FALSE; static TCHAR* sttGetXStatus(const char *szProto)
{
- TCHAR* result = NULL;
-
- if (CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
+ if (CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
TCHAR tszStatus[512];
CUSTOM_STATUS cs = { sizeof(cs) };
cs.flags = CSSF_MASK_MESSAGE | CSSF_TCHAR;
cs.ptszMessage = tszStatus;
- if ( CallProtoServiceInt(NULL, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
- result = mir_tstrdup(tszStatus);
+ if (CallProtoServiceInt(NULL, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
+ return mir_tstrdup(tszStatus);
}
- return result;
+ return NULL;
}
static HICON lastTaskBarIcon;
@@ -391,7 +390,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto)
{
if (!fTrayInited) {
-LBL_Error:
+ LBL_Error:
DestroyIcon(hIcon);
return -1;
}
@@ -410,9 +409,9 @@ LBL_Error: return i;
}
if ((cli.pfnGetProtocolVisibility(szPreferredProto)) &&
- (cli.pfnGetAverageMode(NULL) == -1) &&
- (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) &&
- !(db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
+ (cli.pfnGetAverageMode(NULL) == -1) &&
+ (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) &&
+ !(db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
goto LBL_Error;
}
@@ -860,7 +859,7 @@ void fnInitTray(void) }
FreeLibrary(hLib);
}
- InitializeCriticalSection(&trayLockCS);
+
if (cli.shellVersion >= 5)
CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub);
fTrayInited = TRUE;
@@ -869,19 +868,6 @@ void fnInitTray(void) void fnUninitTray(void)
{
fTrayInited = FALSE;
- DeleteCriticalSection(&trayLockCS);
-}
-
-void fnLockTray(void)
-{
- initcheck;
- EnterCriticalSection(&trayLockCS);
-}
-
-void fnUnlockTray(void)
-{
- initcheck;
- LeaveCriticalSection(&trayLockCS);
}
#undef initcheck
|