Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/user32/button.c | 5 ++--- dlls/user32/tests/msg.c | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index 52e718f8e5..0f56e4e51d 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -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 ); } diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 1d569a37d5..36d1e33aea 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -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);