summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/notifications.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Popup/src/notifications.cpp')
-rw-r--r--plugins/Popup/src/notifications.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp
index 58d0461124..b5a9740f46 100644
--- a/plugins/Popup/src/notifications.cpp
+++ b/plugins/Popup/src/notifications.cpp
@@ -27,13 +27,11 @@ HANDLE g_hntfError, g_hntfWarning, g_hntfNotification;
#define PopupNotificationData_SIGNATURE 0x11BEDA1A
-
int TreeDataSortFunc(const POPUPTREEDATA *p1, const POPUPTREEDATA *p2)
{
if (int cmp = mir_tstrcmp(p1->pszTreeRoot, p2->pszTreeRoot))
return cmp;
return mir_tstrcmp(p1->pszDescription, p2->pszDescription);
-
}
LIST<POPUPTREEDATA> gTreeData(20, TreeDataSortFunc);
@@ -229,12 +227,8 @@ HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ)
{
for (int i = 0; i < gTreeData.getCount(); i++) {
POPUPTREEDATA *p = gTreeData[i];
- if (p->typ == typ &&
- (!group || (mir_tstrcmp(p->pszTreeRoot, group) == 0)) &&
- (!name || (mir_tstrcmp(p->pszDescription, name) == 0)))
- {
+ if (p->typ == typ && (!group || (mir_tstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_tstrcmp(p->pszDescription, name) == 0)))
return p;
- }
}
return NULL;
}
@@ -251,14 +245,14 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen)
ppd->iSeconds = ptd->timeoutValue;
*disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF;
- LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET)
- FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char
+ LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET)
+ FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char
fontid.cbSize = sizeof(fontid);
mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", ptd->notification.lpzName);
ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf);
- ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char
+ ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char
colourid.cbSize = sizeof(colourid);
mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", ptd->notification.lpzName);
@@ -274,8 +268,7 @@ bool IsValidNotification(HANDLE hNotification)
if (!hNotification) return false;
bool res = false;
- __try
- {
+ __try {
if (((POPUPTREEDATA *)hNotification)->signature == PopupNotificationData_SIGNATURE)
res = true;
}
@@ -293,8 +286,7 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam,
POPUPTREEDATA *ptd = (POPUPTREEDATA *)hNotification;
char *lpzAction = NULL;
- switch (message)
- {
+ switch (message) {
case WM_LBUTTONUP:
case WM_COMMAND:
lpzAction = ptd->leftAction;
@@ -312,14 +304,12 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam,
if (!mir_strcmp(lpzAction, POPUP_ACTION_NOTHING))
return true;
- if (!mir_strcmp(lpzAction, POPUP_ACTION_DISMISS))
- {
+ if (!mir_strcmp(lpzAction, POPUP_ACTION_DISMISS)) {
PUDeletePopup(hwnd);
return true;
}
- for (int i = 0; i < ptd->notification.actionCount; ++i)
- {
+ for (int i = 0; i < ptd->notification.actionCount; ++i) {
if (!(ptd->notification.lpActions[i].dwFlags&PNAF_CALLBACK))
continue;
if (mir_strcmp(ptd->notification.lpActions[i].lpzTitle, lpzAction))