Signed-off-by: Roman Pišl rpisl@seznam.cz --- dlls/user32/tests/msg.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index f0e0d0fba76..689ad7161f5 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -140,7 +140,8 @@ typedef enum { hook=0x100, winevent_hook=0x200, kbd_hook=0x400, - winevent_hook_todo=0x800 + winevent_hook_todo=0x800, + has_update=0x1000 } msg_flags_t;
struct message { @@ -2819,6 +2820,10 @@ static void ok_sequence_(const struct message *expected_list, const char *contex context, count, expected->message); if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++;
+ todo_wine_if(expected->flags & has_update) + ok_( file, line) (!(expected->flags & has_update) || (actual->flags & has_update), + "%s: %u: the msg 0x%04x should have update region\n", context, count, expected->message ); + expected++; actual++; } @@ -8270,6 +8275,11 @@ static const struct message WmPaint[] = { { 0 } };
+static const struct message WmPaintUpdate[] = { + { WM_PAINT, sent|has_update }, + { 0 } +}; + static const struct message WmParentOnlyPaint[] = { { WM_PAINT, sent|parent }, { 0 } @@ -8585,6 +8595,13 @@ static void test_paint_messages(void) RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOERASE | RDW_UPDATENOW ); ok_sequence( WmPaint, "Paint", FALSE );
+ flush_sequence(); + SetRectRgn( hrgn, 0, 0, 100, 100 ); + RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | RDW_ERASE ); + SetRectRgn( hrgn, 0, 0, 50, 50 ); + RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOERASE | RDW_UPDATENOW | RDW_NOFRAME ); + ok_sequence( WmPaint, "Paint", FALSE ); + flush_sequence(); SetRectRgn( hrgn, -4, -4, -2, -2 ); RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | RDW_FRAME ); @@ -8629,6 +8646,16 @@ static void test_paint_messages(void) } ok_sequence( WmGetUpdateRect, "GetUpdateRect", FALSE );
+ /* RedrawWindow with both RDW_VALIDATE and RDW_INTERNALPAINT triggers WM_PAINT with non-empty update region */ + flush_sequence(); + InvalidateRect( hwnd, NULL, FALSE ); + GetClientRect( hwnd, &rect ); + SetRectRgn(hrgn, rect.left, rect.top, rect.right, rect.bottom ); + check_update_rgn( hwnd, hrgn ); + RedrawWindow( hwnd, &rect, NULL, RDW_VALIDATE | RDW_NOERASE | RDW_UPDATENOW | RDW_NOFRAME | RDW_INTERNALPAINT ); + check_update_rgn( hwnd, 0 ); + ok_sequence( WmPaintUpdate, "PaintUpdate", FALSE ); + DestroyWindow( hwnd );
/* now test with a child window */ @@ -9949,6 +9976,9 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message, msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; if (beginpaint_counter) msg.flags |= beginpaint; + + if (message == WM_PAINT && GetUpdateRect(hwnd, NULL, FALSE)) msg.flags |= has_update; + msg.wParam = wParam; msg.lParam = lParam; msg.descr = "MsgCheckProc";
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48761 Signed-off-by: Roman Pišl rpisl@seznam.cz --- dlls/user32/tests/msg.c | 1 - server/window.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 689ad7161f5..df468516862 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -2820,7 +2820,6 @@ static void ok_sequence_(const struct message *expected_list, const char *contex context, count, expected->message); if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++;
- todo_wine_if(expected->flags & has_update) ok_( file, line) (!(expected->flags & has_update) || (actual->flags & has_update), "%s: %u: the msg 0x%04x should have update region\n", context, count, expected->message );
diff --git a/server/window.c b/server/window.c index 7675cd1103d..37e240190f8 100644 --- a/server/window.c +++ b/server/window.c @@ -1501,7 +1501,7 @@ static void redraw_window( struct window *win, struct region *region, int frame, if (flags & RDW_FRAME) win->paint_flags |= PAINT_NONCLIENT; if (flags & RDW_ERASE) win->paint_flags |= PAINT_ERASE; } - else if (flags & RDW_VALIDATE) + else if ((flags & RDW_VALIDATE) && !(flags & RDW_INTERNALPAINT)) { if (!region && (flags & RDW_NOFRAME)) /* shortcut: validate everything */ {
struct message {
@@ -2819,6 +2820,10 @@ static void ok_sequence_(const struct message *expected_list, const char *contex context, count, expected->message); if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++;
todo_wine_if(expected->flags & has_update)
ok_( file, line) (!(expected->flags & has_update) || (actual->flags & has_update),
"%s: %u: the msg 0x%04x should have update region\n", context, count, expected->message );
}expected++; actual++;
Hi Roman
please, don't outdent the todo_wine*
that generates warnings with mingw gcc 11.x
thanks
Hi Eric,
Dne 19. 02. 22 v 19:49 Eric Pouech napsal(a):
struct message {
@@ -2819,6 +2820,10 @@ static void ok_sequence_(const struct message *expected_list, const char *contex context, count, expected->message); if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++; + todo_wine_if(expected->flags & has_update) + ok_( file, line) (!(expected->flags & has_update) || (actual->flags & has_update), + "%s: %u: the msg 0x%04x should have update region\n", context, count, expected->message );
expected++; actual++; }
Hi Roman
please, don't outdent the todo_wine*
that generates warnings with mingw gcc 11.x
thanks
unfortunately this code mixes tabs and spaces in a very ugly way - it indents by 4 but tab size is expected to be 8. I'll fix it in the next version after review..
Or would a patch that removes completely all tabs from the file be acceptable?
Thanks
Roman
Le 19/02/2022 à 20:38, Roman Pišl a écrit :
Hi Eric,
Dne 19. 02. 22 v 19:49 Eric Pouech napsal(a):
struct message {
@@ -2819,6 +2820,10 @@ static void ok_sequence_(const struct message *expected_list, const char *contex context, count, expected->message); if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++; + todo_wine_if(expected->flags & has_update) + ok_( file, line) (!(expected->flags & has_update) || (actual->flags & has_update), + "%s: %u: the msg 0x%04x should have update region\n", context, count, expected->message );
expected++; actual++; }
Hi Roman
please, don't outdent the todo_wine*
that generates warnings with mingw gcc 11.x
thanks
unfortunately this code mixes tabs and spaces in a very ugly way - it indents by 4 but tab size is expected to be 8. I'll fix it in the next version after review..
Or would a patch that removes completely all tabs from the file be acceptable?
no. gratuitous space/tab changes are not accepted.
generally, for space/tab choice, the rule is to keep the options taken for the file to edit...
hard to tell on this file what's the choice made <g>
in this case, I'd say go for spaces only.
A+
On 2022-02-19 22:59, Eric Pouech wrote:
Le 19/02/2022 à 20:38, Roman Pišl a écrit :
unfortunately this code mixes tabs and spaces in a very ugly way - it indents by 4 but tab size is expected to be 8. I'll fix it in the next version after review..
Or would a patch that removes completely all tabs from the file be acceptable?
generally, for space/tab choice, the rule is to keep the options taken for the file to edit...
hard to tell on this file what's the choice made <g>
in this case, I'd say go for spaces only.
IIRC, fifteen years ago specifically that was the de-facto rule. I guess it's still valid: https://wiki.winehq.org/Wine_Developer%27s_Guide/Coding_Practice#Some_notes_....
- Tabs are not forbidden but discouraged. A tab is defined as 8
characters and the usual amount of indentation is 4 characters.
S.