user32: WM_SETFONT on button doesn't repaint directly

Clinton Stimpson cjstimpson at utwire.net
Tue Feb 6 12:10:15 CST 2007


Hi,

So here's the latest with a couple corrections based on feedback (thanks).
Use GetStockObject to get a font instead of making one.
Add back the call to UpdateWindow.
If this isn't accepted, can I get a reason why?  I don't like spamming 
wine-patches with this bug fix :)

Thanks,
Clinton Stimpson

ChangeLog:
    Setting font on button doesn't repaint directly.

-------------- next part --------------
Index: dlls/user32/button.c
===================================================================
RCS file: /home/wine/wine/dlls/user32/button.c,v
retrieving revision 1.1
diff -u -r1.1 button.c
--- dlls/user32/button.c	16 Nov 2006 14:02:17 -0000	1.1
+++ dlls/user32/button.c	6 Feb 2007 18:04:58 -0000
@@ -410,7 +410,7 @@
 
     case WM_SETFONT:
         set_button_font( hWnd, (HFONT)wParam );
-        if (lParam) paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
+        if (lParam) InvalidateRect(hWnd, NULL, TRUE);
         break;
 
     case WM_GETFONT:
Index: dlls/user32/tests/msg.c
===================================================================
RCS file: /home/wine/wine/dlls/user32/tests/msg.c,v
retrieving revision 1.16
diff -u -r1.16 msg.c
--- dlls/user32/tests/msg.c	5 Feb 2007 21:27:40 -0000	1.16
+++ dlls/user32/tests/msg.c	6 Feb 2007 18:04:58 -0000
@@ -4229,6 +4229,14 @@
     { WM_CAPTURECHANGED, sent|wparam|defwinproc, 0 },
     { 0 }
 };
+static const struct message WmSetFontButtonSeq[] =
+{
+    { WM_SETFONT, sent },
+    { WM_PAINT, sent },
+    { WM_ERASEBKGND, sent|defwinproc },
+    { WM_CTLCOLORBTN, sent|defwinproc },
+    { 0 }
+};
 
 static WNDPROC old_button_proc;
 
@@ -4309,6 +4317,7 @@
     unsigned int i;
     HWND hwnd;
     DWORD dlg_code;
+    HFONT zfont;
 
     subclass_button();
 
@@ -4348,6 +4357,13 @@
 
     SendMessageA(hwnd, WM_LBUTTONUP, 0, 0);
     ok_sequence(WmLButtonUpSeq, "WM_LBUTTONUP on a button", FALSE);
+
+    flush_sequence();
+    zfont = (HFONT)GetStockObject(SYSTEM_FONT);
+    SendMessageA(hwnd, WM_SETFONT, (WPARAM)zfont, TRUE);
+    UpdateWindow(hwnd);
+    ok_sequence(WmSetFontButtonSeq, "WM_SETFONT on a button", FALSE);
+    
     DestroyWindow(hwnd);
 }
 


More information about the wine-patches mailing list