From: Paul Gofman pgofman@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58210 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38975 --- dlls/user32/tests/win.c | 10 +++++----- server/window.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index dc7e7387cdf..fc1b79d0628 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -10968,7 +10968,7 @@ static void test_update_region(void) SetWindowPos(parent, NULL, 0, 0, 350, 200, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); GetUpdateRect(parent, &r, FALSE); GetClientRect(parent, &expect_rect); - todo_wine ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); + ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); ValidateRect(parent, NULL);
SetWindowPos(parent, NULL, 0, 0, 300, 150, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); @@ -10983,7 +10983,7 @@ static void test_update_region(void) SetWindowPos(parent, NULL, 0, 0, 350, 200, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); GetUpdateRect(parent, &r, FALSE); GetClientRect(parent, &expect_rect); - todo_wine ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); + ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); pump_messages(); RedrawWindow(parent, NULL, 0, RDW_VALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
@@ -10999,7 +10999,7 @@ static void test_update_region(void) SetWindowPos(hwnd, NULL, 0, 0, 210, 110, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); GetUpdateRect(hwnd, &r, FALSE); GetClientRect(hwnd, &expect_rect); - todo_wine ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); + ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); ValidateRect(hwnd, NULL); ValidateRect(parent, NULL); SetWindowPos(hwnd, NULL, 0, 0, 200, 100, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); @@ -11014,7 +11014,7 @@ static void test_update_region(void) SetWindowPos(hwnd, NULL, 0, 0, 210, 110, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); GetUpdateRect(hwnd, &r, FALSE); GetClientRect(hwnd, &expect_rect); - todo_wine ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); + ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); ValidateRect(hwnd, NULL); ValidateRect(parent, NULL); SetWindowPos(hwnd, NULL, 0, 0, 200, 100, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); @@ -11033,7 +11033,7 @@ static void test_update_region(void) GetClientRect(parent, &r); expect_rect.bottom = r.bottom - 150; GetUpdateRect(hwnd, &r, FALSE); - todo_wine ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); + ok(EqualRect(&r, &expect_rect), "got %s, expected %s.\n", wine_dbgstr_rect(&r), wine_dbgstr_rect(&expect_rect)); ValidateRect(hwnd, NULL); ValidateRect(parent, NULL); SetWindowPos(hwnd, NULL, 0, 0, 200, 100, SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); diff --git a/server/window.c b/server/window.c index 1961e977133..039c51958e4 100644 --- a/server/window.c +++ b/server/window.c @@ -134,6 +134,7 @@ static const struct object_ops window_ops = #define PAINT_NONCLIENT 0x0040 /* needs WM_NCPAINT */ #define PAINT_DELAYED_ERASE 0x0080 /* still needs erase after WM_ERASEBKGND */ #define PAINT_PIXEL_FORMAT_CHILD 0x0100 /* at least one child has a custom pixel format */ +#define PAINT_INVALIDATED 0x0200 /* window has been fully invalidated */
/* growable array of user handles */ struct user_handle_array @@ -1466,7 +1467,7 @@ static void set_update_region( struct window *win, struct region *region ) inc_window_paint_count( win, -1 ); free_region( win->update_region ); } - win->paint_flags &= ~(PAINT_ERASE | PAINT_DELAYED_ERASE | PAINT_NONCLIENT); + win->paint_flags &= ~(PAINT_ERASE | PAINT_DELAYED_ERASE | PAINT_NONCLIENT | PAINT_INVALIDATED); win->update_region = NULL; if (region) free_region( region ); } @@ -1547,7 +1548,7 @@ static void validate_non_client( struct window *win ) else free_region( tmp ); } - win->paint_flags &= ~PAINT_NONCLIENT; + win->paint_flags &= ~(PAINT_NONCLIENT | PAINT_INVALIDATED); }
@@ -1628,6 +1629,7 @@ static void redraw_window( struct window *win, struct region *region, unsigned i
if (!add_update_region( win, tmp )) return;
+ if (!region) win->paint_flags |= PAINT_INVALIDATED; if (flags & RDW_FRAME) win->paint_flags |= PAINT_NONCLIENT; if (flags & RDW_ERASE) win->paint_flags |= PAINT_ERASE; } @@ -1651,6 +1653,7 @@ static void redraw_window( struct window *win, struct region *region, unsigned i if (flags & RDW_NOFRAME) validate_non_client( win ); if (flags & RDW_NOERASE) win->paint_flags &= ~(PAINT_ERASE | PAINT_DELAYED_ERASE); } + win->paint_flags &= ~PAINT_INVALIDATED; }
if ((flags & RDW_INTERNALPAINT) && !(win->paint_flags & PAINT_INTERNAL)) @@ -1962,6 +1965,10 @@ static void set_window_pos( struct window *win, struct window *previous,
if (win->update_region) { + int frame = win->paint_flags & PAINT_NONCLIENT; + if ((win->paint_flags & PAINT_INVALIDATED) && get_window_visible_rect( win, &rect, frame )) + set_region_rect( win->update_region, &rect ); + if (get_window_visible_rect( win, &rect, 1 )) { struct region *tmp = create_empty_region();