user32: Respect margins more in DrawTextExW().

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2018-06-04 19:58:07 +08:00 committed by Alexandre Julliard
parent 5dfacee5cc
commit 11e3cf091d
1 changed files with 5 additions and 3 deletions

View File

@ -943,6 +943,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
{ {
lmargin = dtp->iLeftMargin; lmargin = dtp->iLeftMargin;
rmargin = dtp->iRightMargin; rmargin = dtp->iRightMargin;
width -= lmargin + rmargin;
if (!(flags & (DT_CENTER | DT_RIGHT))) if (!(flags & (DT_CENTER | DT_RIGHT)))
x += lmargin; x += lmargin;
dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */ dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */
@ -978,9 +979,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom; last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom;
strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, retstr, tabwidth, &prefix_offset, &ellip); strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, retstr, tabwidth, &prefix_offset, &ellip);
if (flags & DT_CENTER) x = (rect->left + rect->right - if (flags & DT_CENTER)
size.cx) / 2; x = (rect->left + lmargin + rect->right - rmargin - size.cx) / 2;
else if (flags & DT_RIGHT) x = rect->right - size.cx; else if (flags & DT_RIGHT)
x = rect->right - size.cx - rmargin;
if (flags & DT_SINGLELINE) if (flags & DT_SINGLELINE)
{ {