diff options
author | George Hazan <ghazan@miranda.im> | 2018-09-12 19:29:24 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-09-12 19:29:24 +0300 |
commit | cc03b109287f4c818a4d6df09cbfa48784e1e4a6 (patch) | |
tree | b1ffc9ccbdbe2858f3ae8297f8b411ba4da27a53 /plugins/Popup | |
parent | dc059a02a3d8d1f3f509ba31b7618cee001cba93 (diff) |
Popup: fix for drawing clock borders for the missing clock
Diffstat (limited to 'plugins/Popup')
-rw-r--r-- | plugins/Popup/src/skin.cpp | 20 |
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);
}
|