summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-09-12 19:29:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-09-12 19:29:24 +0300
commitcc03b109287f4c818a4d6df09cbfa48784e1e4a6 (patch)
treeb1ffc9ccbdbe2858f3ae8297f8b411ba4da27a53 /plugins/Popup
parentdc059a02a3d8d1f3f509ba31b7618cee001cba93 (diff)
Popup: fix for drawing clock borders for the missing clock
Diffstat (limited to 'plugins/Popup')
-rw-r--r--plugins/Popup/src/skin.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp
index 34ef0665df..0ccfdca254 100644
--- a/plugins/Popup/src/skin.cpp
+++ b/plugins/Popup/src/skin.cpp
@@ -331,14 +331,20 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
case ST_CLOCK:
if (head && head->myBmp) {
- szNew.cx = head->clocksize[CLOCK_LEFT] + head->clocksize[CLOCK_RIGHT];
- szNew.cy = head->myBmp->getHeight();
- for (wchar_t *p = wnd->getTime(); *p; p++) {
- if (*p == ':')
- szNew.cx += head->clocksize[CLOCK_SEPARATOR];
- else if ((*p >= '0') && (*p <= '9'))
- szNew.cx += head->clocksize[CLOCK_DIGITS + *p - '0'];
+ wchar_t *p = wnd->getTime();
+ if (*p != 0) {
+ szNew.cx = head->clocksize[CLOCK_LEFT] + head->clocksize[CLOCK_RIGHT];
+ szNew.cy = head->myBmp->getHeight();
+ while (*p) {
+ if (*p == ':')
+ szNew.cx += head->clocksize[CLOCK_SEPARATOR];
+ else if ((*p >= '0') && (*p <= '9'))
+ szNew.cx += head->clocksize[CLOCK_DIGITS + *p - '0'];
+ p++;
+ }
}
+ else szNew.cx = szNew.cy = 0;
+
wnd->getArgs()->add("clock.width", szNew.cx);
wnd->getArgs()->add("clock.height", szNew.cy);
}