user32: WM_SETFONT on button shouldn't repaint directly

Clinton Stimpson cjstimpson at utwire.net
Wed Jan 24 23:22:57 CST 2007


Fix WM_SETFONT on a button to invalidate the rect instead of painting it 
directly.
Test included.
I verified the test passes on Windows too.
Hope I got it right this time.

Thanks,
Clinton Stimpson

ChangeLog:
  user32: don't repaint button directly when setting font

-------------- next part --------------
? dlls/user32/'
? dlls/user32/tests/Output
? dlls/user32/tests/out
? dlls/user32/tests/output
? dlls/user32/tests/user32_test.dsp
? dlls/user32/tests/user32_test.plg
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	25 Jan 2007 05:16:25 -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.15
diff -u -r1.15 msg.c
--- dlls/user32/tests/msg.c	9 Jan 2007 12:11:42 -0000	1.15
+++ dlls/user32/tests/msg.c	25 Jan 2007 05:16:26 -0000
@@ -4159,6 +4159,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;
 
@@ -4239,6 +4247,8 @@
     unsigned int i;
     HWND hwnd;
     DWORD dlg_code;
+    LOGFONTA lf;
+    HFONT zfont;
 
     subclass_button();
 
@@ -4278,6 +4288,23 @@
 
     SendMessageA(hwnd, WM_LBUTTONUP, 0, 0);
     ok_sequence(WmLButtonUpSeq, "WM_LBUTTONUP on a button", FALSE);
+
+    flush_sequence();
+    lstrcpyA(lf.lfFaceName, "Symbol");
+    lf.lfHeight = 10;
+    lf.lfItalic = 0;
+    lf.lfEscapement = 0;
+    lf.lfOrientation = 0;
+    lf.lfUnderline = 0;
+    lf.lfStrikeOut = 0;
+    lf.lfWeight = 3;
+    lf.lfWidth = 10;
+    zfont = CreateFontIndirectA(&lf);
+    SendMessageA(hwnd, WM_SETFONT, (WPARAM)zfont, TRUE);
+    UpdateWindow(hwnd);
+    ok_sequence(WmSetFontButtonSeq, "WM_SETFONT on a button", FALSE);
+    DeleteObject(zfont);
+    
     DestroyWindow(hwnd);
 }
 


More information about the wine-patches mailing list