user32: invalidate button area instead of painting immediatly
Clinton Stimpson
cjstimpson at utwire.net
Thu Jan 18 02:14:56 CST 2007
WM_SETFONT on a button should invalidate the area so the system can send
a WM_PAINT event, instead of painting the button immediately.
Test included.
Thanks,
Clinton Stimpson
ChangeLog:
user32: invalidate button area instead of painting button immediately.
-------------- 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 18 Jan 2007 08:08:31 -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 18 Jan 2007 08:08:31 -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;
@@ -4206,6 +4214,7 @@
static void test_button_messages(void)
{
+ MSG msg;
static const struct
{
DWORD style;
@@ -4239,6 +4248,8 @@
unsigned int i;
HWND hwnd;
DWORD dlg_code;
+ LOGFONTA lf;
+ HFONT zfont;
subclass_button();
@@ -4278,6 +4289,24 @@
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);
+
DestroyWindow(hwnd);
}
More information about the wine-patches
mailing list