Commit b7a08c92 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

user32/button: Do not select old font back after painting.

parent ab3c0a3e
......@@ -1096,7 +1096,7 @@ static void OB_Paint( HWND hwnd, HDC hDC, UINT action )
DRAWITEMSTRUCT dis;
LONG_PTR id = GetWindowLongPtrW( hwnd, GWLP_ID );
HWND parent;
HFONT hFont, hPrevFont = 0;
HFONT hFont;
HRGN hrgn;
dis.CtlType = ODT_BUTTON;
......@@ -1111,7 +1111,7 @@ static void OB_Paint( HWND hwnd, HDC hDC, UINT action )
dis.itemData = 0;
GetClientRect( hwnd, &dis.rcItem );
if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hDC, hFont );
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
parent = GetParent(hwnd);
if (!parent) parent = hwnd;
SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
......@@ -1119,7 +1119,6 @@ static void OB_Paint( HWND hwnd, HDC hDC, UINT action )
hrgn = set_control_clipping( hDC, &dis.rcItem );
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
if (hPrevFont) SelectObject(hDC, hPrevFont);
SelectClipRgn( hDC, hrgn );
if (hrgn) DeleteObject( hrgn );
}
......@@ -6466,15 +6466,13 @@ static void test_button_messages(void)
prevfont = SelectObject(hdc, hfont2);
ok(prevfont == GetStockObject(SYSTEM_FONT), "Unexpected default font\n");
SendMessageA(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, 0);
todo_wine
ok(GetStockObject(SYSTEM_FONT) == GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PRINTCLIENT\n", i);
ok(hfont2 != GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PRINTCLIENT\n", i);
SelectObject(hdc, prevfont);
prevfont = SelectObject(hdc, hfont2);
ok(prevfont == GetStockObject(SYSTEM_FONT), "Unexpected default font\n");
SendMessageA(hwnd, WM_PAINT, (WPARAM)hdc, 0);
todo_wine
ok(GetStockObject(SYSTEM_FONT) == GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PAINT\n", i);
ok(hfont2 != GetCurrentObject(hdc, OBJ_FONT), "button[%u]: unexpected font selected after WM_PAINT\n", i);
SelectObject(hdc, prevfont);
DeleteDC(hdc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment