Author: jimtabor
Date: Fri Feb 10 16:05:15 2017
New Revision: 73768
URL:
http://svn.reactos.org/svn/reactos?rev=73768&view=rev
Log:
[User32]
- Patch by Dmitry Timoshkov : Fix groupbox rectangle calculation in the button's
WM_SETTEXT handler. BUTTON_CalcLabelRect should use the button font. Otherwise WM_SETTEXT
handler gets wrong rectangle to erase an old text.
- Fixes CORE-12464.
Modified:
trunk/reactos/win32ss/user/user32/controls/button.c
Modified: trunk/reactos/win32ss/user/user32/controls/button.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/contro…
==============================================================================
--- trunk/reactos/win32ss/user/user32/controls/button.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/controls/button.c [iso-8859-1] Fri Feb 10 16:05:15
2017
@@ -496,6 +496,9 @@
GetClientRect(hWnd, &client);
rc = client;
+ /* FIXME: check other BS_* handlers */
+ if (btn_type == BS_GROUPBOX)
+ InflateRect(&rc, -7, 1); /* GB_Paint does this */
BUTTON_CalcLabelRect(hWnd, hdc, &rc);
/* Clip by client rect bounds */
if (rc.right > client.right) rc.right = client.right;
@@ -759,19 +762,26 @@
switch (style & (BS_ICON|BS_BITMAP))
{
case BS_TEXT:
+ {
+ HFONT hFont, hPrevFont = 0;
+
if (!(text = get_button_text( hwnd ))) goto empty_rect;
if (!text[0])
{
HeapFree( GetProcessHeap(), 0, text );
goto empty_rect;
}
+
+ if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hdc, hFont );
DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
+ if (hPrevFont) SelectObject( hdc, hPrevFont );
HeapFree( GetProcessHeap(), 0, text );
#ifdef __REACTOS__
if (get_ui_state(hwnd) & UISF_HIDEACCEL)
dtStyle |= DT_HIDEPREFIX;
#endif
break;
+ }
case BS_ICON:
if (!GetIconInfo((HICON)GetWindowLongPtrW( hwnd, HIMAGE_GWL_OFFSET ),
&iconInfo))