user32: WM_SETFONT on button shouldn't repaint directly
Clinton Stimpson
cjstimpson at utwire.net
Fri Jan 19 00:14:30 CST 2007
This patch includes a couple improvements over the patch submitted
yesterday.
Fix WM_SETFONT on a button to invalidate the rect instead of painting it
directly.
Test included.
Thanks,
Clinton Stimpson
ChangeLog:
user32: don't repaint button directly when setting font
-------------- 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 19 Jan 2007 06:03:45 -0000
@@ -410,7 +410,7 @@
case WM_SETFONT:
set_button_font( hWnd, (HFONT)wParam );
- if (lParam) paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
+ if (LOWORD(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 19 Jan 2007 06:03:45 -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,9 @@
unsigned int i;
HWND hwnd;
DWORD dlg_code;
+ MSG msg;
+ LOGFONTA lf;
+ HFONT zfont;
subclass_button();
@@ -4278,6 +4289,25 @@
SendMessageA(hwnd, WM_LBUTTONUP, 0, 0);
ok_sequence(WmLButtonUpSeq, "WM_LBUTTONUP on a button", FALSE);
+
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ 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);
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ ok_sequence(WmSetFontButtonSeq, "WM_SETFONT on a button", FALSE);
+ DeleteObject(zfont);
+
DestroyWindow(hwnd);
}
More information about the wine-patches
mailing list