diff options
Diffstat (limited to 'alf/alfbutton.cpp')
| -rw-r--r-- | alf/alfbutton.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/alf/alfbutton.cpp b/alf/alfbutton.cpp index b32831a..0723563 100644 --- a/alf/alfbutton.cpp +++ b/alf/alfbutton.cpp @@ -52,21 +52,19 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT SelectFont(hdc, oldFont); ReleaseDC(hwnd, hdc); - } else if (uMsg == WM_NCCALCSIZE) { - /* HACK: a themed button contains a 1px margin. An unthemed button - * does not, so we add one by shrinking the client area */ - RECT *r = (RECT *)lParam; + } else if (uMsg == ALF_WM_APPLYSIZE) { + // HACK: a themed button contains a 1px margin. An unthemed button + // does not, so we add one. - int retval = app->compatFn->DefSubclassProc(hwnd, uMsg, wParam, lParam); + RECT *p = (RECT *)lParam; - if (!app->compatFn->IsAppThemed()) { - r->top += 1; - r->bottom -= 1; - } + int padding = app->compatFn->IsAppThemed() ? 0 : 1; - return retval; - } else if (uMsg == WM_THEMECHANGED) { - SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED); + return (LRESULT)DeferWindowPos((HDWP)wParam, + hwnd, NULL, + p->left, p->top + padding, + p->right - p->left, p->bottom - p->top - 2*padding, + SWP_NOZORDER|SWP_NOACTIVATE); } return app->compatFn->DefSubclassProc(hwnd, uMsg, wParam, lParam); @@ -97,7 +95,7 @@ ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const WCHAR *text) p.y = y; p.width = 5625; p.height = 0; - p.flags = ALF_QUERYSIZE | ALF_MESSAGEFONT; + p.flags = ALF_QUERYSIZE | ALF_MESSAGEFONT | ALF_APPLYSIZE; ALF_AddWidgetEx(win, &p); |
