diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-06 18:26:47 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-06 18:26:47 +0000 |
commit | a27b07c35565ced7f690890dcba29518ae2e4928 (patch) | |
tree | d599c43d8448816a5fcc5f09838dd817b59f3b3f /src/mir_app | |
parent | a609a99eebd89fca7955c8957fc0f2e99c8ededb (diff) |
MS_CLIST_SYSTRAY_NOTIFY - more useless code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@17268 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/clc.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/clistcore.cpp | 1 | ||||
-rw-r--r-- | src/mir_app/src/clisttray.cpp | 103 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 |
5 files changed, 56 insertions, 53 deletions
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index ab06801d8e..b58e36d1fc 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -157,7 +157,6 @@ extern mir_cs trayLockCS; void fnInitTray(void);
void fnUninitTray(void);
-int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY *msn);
int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status);
int fnTrayIconDestroy(HWND hwnd);
void fnTrayIconIconsChanged(void);
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 7e16017196..684b76d63d 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -173,7 +173,6 @@ MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void) cli.pfnTrayIconUpdateBase = fnTrayIconUpdateBase;
cli.pfnTrayCalcChanged = fnTrayCalcChanged;
cli.pfnTrayIconUpdateWithImageList = fnTrayIconUpdateWithImageList;
- cli.pfnCListTrayNotify = fnCListTrayNotify;
cli.pfnContactListWndProc = fnContactListWndProc;
cli.pfnLoadCluiGlobalOpts = fnLoadCluiGlobalOpts;
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 1b58b6647e..eae3fccf6c 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -764,71 +764,73 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// processes tray icon's notifications
-int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn)
+static int sttGetIcon(const char *szProto)
{
- if (msn == NULL)
- return 1;
-
- if (msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL)
- return 1;
-
- if (cli.trayIcon == NULL)
- return 2;
+ if (szProto == NULL)
+ return cli.trayIcon[0].id;
UINT iconId = 0;
- if (msn->szProto) {
- for (int j = 0; j < cli.trayIconCount; j++) {
- if (cli.trayIcon[j].szProto != NULL) {
- if (!mir_strcmp(msn->szProto, cli.trayIcon[j].szProto)) {
- iconId = cli.trayIcon[j].id;
- break;
- }
- }
- else if (cli.trayIcon[j].isBase) {
+
+ for (int j = 0; j < cli.trayIconCount; j++) {
+ if (cli.trayIcon[j].szProto != NULL) {
+ if (!mir_strcmp(szProto, cli.trayIcon[j].szProto)) {
iconId = cli.trayIcon[j].id;
break;
}
}
+ else if (cli.trayIcon[j].isBase) {
+ iconId = cli.trayIcon[j].id;
+ break;
+ }
}
- else iconId = cli.trayIcon[0].id;
-
- if (msn->dwInfoFlags & NIIF_INTERN_UNICODE) {
- NOTIFYICONDATAW nid = { 0 };
- nid.cbSize = NOTIFYICONDATAW_V2_SIZE;
- nid.hWnd = cli.hwndContactList;
- nid.uID = iconId;
- nid.uFlags = NIF_INFO;
- mir_wstrncpy(nid.szInfo, msn->tszInfo, _countof(nid.szInfo));
- mir_wstrncpy(nid.szInfoTitle, msn->tszInfoTitle, _countof(nid.szInfoTitle));
- nid.szInfo[_countof(nid.szInfo) - 1] = 0;
- nid.szInfoTitle[_countof(nid.szInfoTitle) - 1] = 0;
- nid.uTimeout = msn->uTimeout;
- nid.dwInfoFlags = (msn->dwInfoFlags & ~NIIF_INTERN_UNICODE);
- return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0;
- }
- else {
- NOTIFYICONDATAA nid = { 0 };
- nid.cbSize = NOTIFYICONDATAA_V2_SIZE;
- nid.hWnd = cli.hwndContactList;
- nid.uID = iconId;
- nid.uFlags = NIF_INFO;
- strncpy_s(nid.szInfo, msn->szInfo, _TRUNCATE);
- strncpy_s(nid.szInfoTitle, msn->szInfoTitle, _TRUNCATE);
- nid.uTimeout = msn->uTimeout;
- nid.dwInfoFlags = msn->dwInfoFlags;
- return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0;
- }
+
+ return iconId;
}
-/////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(int) Clist_TrayNotifyA(const char *szProto, const char *szInfoTitle, const char *szInfo, DWORD dwInfoFlags, UINT uTimeout)
+{
+ if (szInfo == NULL || szInfoTitle == NULL)
+ return 1;
+ if (cli.trayIcon == NULL)
+ return 2;
-static DLLVERSIONINFO dviShell = { sizeof(dviShell) };
+ NOTIFYICONDATAA nid = { 0 };
+ nid.cbSize = NOTIFYICONDATAA_V2_SIZE;
+ nid.hWnd = cli.hwndContactList;
+ nid.uID = sttGetIcon(szProto);
+ nid.uFlags = NIF_INFO;
+ strncpy_s(nid.szInfo, szInfo, _TRUNCATE);
+ strncpy_s(nid.szInfoTitle, szInfoTitle, _TRUNCATE);
+ nid.uTimeout = uTimeout;
+ nid.dwInfoFlags = dwInfoFlags;
+ return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0;
+}
-static INT_PTR pfnCListTrayNotifyStub(WPARAM, LPARAM lParam)
+MIR_APP_DLL(int) Clist_TrayNotifyW(const char *szProto, const wchar_t *wszInfoTitle, const wchar_t *wszInfo, DWORD dwInfoFlags, UINT uTimeout)
{
- return cli.pfnCListTrayNotify((MIRANDASYSTRAYNOTIFY*)lParam);
+ if (wszInfo == NULL || wszInfoTitle == NULL)
+ return 1;
+ if (cli.trayIcon == NULL)
+ return 2;
+
+ NOTIFYICONDATAW nid = { 0 };
+ nid.cbSize = NOTIFYICONDATAW_V2_SIZE;
+ nid.hWnd = cli.hwndContactList;
+ nid.uID = sttGetIcon(szProto);
+ nid.uFlags = NIF_INFO;
+ mir_wstrncpy(nid.szInfo, wszInfo, _countof(nid.szInfo));
+ mir_wstrncpy(nid.szInfoTitle, wszInfoTitle, _countof(nid.szInfoTitle));
+ nid.szInfo[_countof(nid.szInfo) - 1] = 0;
+ nid.szInfoTitle[_countof(nid.szInfoTitle) - 1] = 0;
+ nid.uTimeout = uTimeout;
+ nid.dwInfoFlags = dwInfoFlags;
+ return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static DLLVERSIONINFO dviShell = { sizeof(dviShell) };
+
void fnInitTray(void)
{
if (HMODULE hLib = GetModuleHandleA("shell32")) {
@@ -838,7 +840,6 @@ void fnInitTray(void) }
}
- CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub);
fTrayInited = TRUE;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 0eb0475b37..00556c908f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -273,3 +273,5 @@ Clist_ContactCompare @272 Clist_ContactDoubleClicked @273
Clist_GetImageList @274
Clist_GetInterface @275
+Clist_TrayNotifyA @276
+Clist_TrayNotifyW @277
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 1d6f6103f9..7a39c78b76 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -273,3 +273,5 @@ Clist_ContactCompare @272 Clist_ContactDoubleClicked @273
Clist_GetImageList @274
Clist_GetInterface @275
+Clist_TrayNotifyA @276
+Clist_TrayNotifyW @277
|