user32: Make spacing consistent between DrawCaptionTemp and NC_DrawCaption.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-05-26 22:12:08 +09:00
parent b4bccfee05
commit 5fdcacad0a
1 changed files with 9 additions and 10 deletions

View File

@ -312,12 +312,13 @@ BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
if (!hIcon) hIcon = NC_IconForWindow(hwnd); if (!hIcon) hIcon = NC_IconForWindow(hwnd);
DrawIconEx (hdc, pt.x, pt.y, hIcon, GetSystemMetrics(SM_CXSMICON), DrawIconEx (hdc, pt.x, pt.y, hIcon, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
rc.left += (rc.bottom - rc.top); rc.left = pt.x + GetSystemMetrics( SM_CXSMICON );
} }
/* drawing text */ /* drawing text */
if (uFlags & DC_TEXT) { if (uFlags & DC_TEXT) {
HFONT hOldFont; HFONT hOldFont;
WCHAR text[128];
if (uFlags & DC_INBUTTON) if (uFlags & DC_INBUTTON)
SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT)); SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT));
@ -340,16 +341,14 @@ BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
hOldFont = SelectObject (hdc, hNewFont); hOldFont = SelectObject (hdc, hNewFont);
} }
if (str) if (!str)
DrawTextW (hdc, str, -1, &rc, {
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); if (!GetWindowTextW( hwnd, text, sizeof(text)/sizeof(WCHAR) )) text[0] = 0;
else { str = text;
WCHAR szText[128];
INT nLen;
nLen = GetWindowTextW (hwnd, szText, 128);
DrawTextW (hdc, szText, nLen, &rc,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
} }
rc.left += 2;
DrawTextW( hdc, str, -1, &rc, ((uFlags & 0x4000) ? DT_CENTER : DT_LEFT) |
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_END_ELLIPSIS );
if (hFont) if (hFont)
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);