Fabian Maurer : user32: Send WM_NCPAINT and WM_ERASEBKGND when window is shown.
Alexandre Julliard
julliard at winehq.org
Thu Jul 20 12:11:28 CDT 2017
Module: wine
Branch: stable
Commit: 13733fede313dca7c4cc17be895354ff443043aa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=13733fede313dca7c4cc17be895354ff443043aa
Author: Fabian Maurer <dark.shadow4 at web.de>
Date: Mon Feb 13 16:58:29 2017 +0100
user32: Send WM_NCPAINT and WM_ERASEBKGND when window is shown.
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 997d4ef44f0f9e2284f99d7ce9ec135d68b30c7b)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/user32/tests/msg.c | 26 +++++++++++++-------------
dlls/user32/winpos.c | 33 +++++++++++++++++++++++----------
2 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 11e31ad..cd757b8 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -4647,7 +4647,7 @@ static void test_showwindow(void)
flush_sequence();
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
ok_sequence(WmShowMaxPopupResizedSeq_todo,
- "ShowWindow(SW_SHOWMAXIMIZED):invisible maximized and resized popup TODO", FALSE);
+ "ShowWindow(SW_SHOWMAXIMIZED):invisible maximized and resized popup TODO", TRUE);
DestroyWindow(hwnd);
flush_sequence();
@@ -5131,7 +5131,7 @@ static void test_messages(void)
10, 10, 100, 100, NULL, 0, 0, NULL );
ok (hwnd != 0, "Failed to create popup window\n");
RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW);
- ok_sequence(WmShowPopupFirstDrawSeq_1, "RedrawWindow:show_popup_first_draw_visible", TRUE);
+ ok_sequence(WmShowPopupFirstDrawSeq_1, "RedrawWindow:show_popup_first_draw_visible", FALSE);
DestroyWindow(hwnd);
/* Invisible, show, message */
@@ -5142,7 +5142,7 @@ static void test_messages(void)
ok (hwnd != 0, "Failed to create popup window\n");
ShowWindow(hwnd, SW_SHOW);
SendMessageW(hwnd, WM_PAINT, 0, 0);
- ok_sequence(WmShowPopupFirstDrawSeq_1, "RedrawWindow:show_popup_first_draw_show", TRUE);
+ ok_sequence(WmShowPopupFirstDrawSeq_1, "RedrawWindow:show_popup_first_draw_show", FALSE);
DestroyWindow(hwnd);
/* Invisible, show maximized, redraw */
@@ -5153,20 +5153,20 @@ static void test_messages(void)
ok (hwnd != 0, "Failed to create popup window\n");
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW);
- ok_sequence(WmShowPopupFirstDrawSeq_2, "RedrawWindow:show_popup_first_draw_show_maximized", TRUE);
+ ok_sequence(WmShowPopupFirstDrawSeq_2, "RedrawWindow:show_popup_first_draw_show_maximized", FALSE);
DestroyWindow(hwnd);
/* Test SetWindowPos */
- test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW, TRUE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq2, 0, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3,
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER, TRUE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOSIZE, TRUE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq4, SWP_SHOWWINDOW | SWP_NOMOVE, TRUE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOSIZE, FALSE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq4, SWP_SHOWWINDOW | SWP_NOMOVE, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3, SWP_SHOWWINDOW | SWP_NOCLIENTSIZE, TRUE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3, SWP_SHOWWINDOW | SWP_NOCLIENTMOVE, TRUE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOZORDER, TRUE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOZORDER, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq2, SWP_SHOWWINDOW | SWP_DEFERERASE, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3, SWP_SHOWWINDOW | SWP_DEFERERASE | SWP_NOCLIENTMOVE, TRUE);
@@ -5175,12 +5175,12 @@ static void test_messages(void)
test_msg_setpos(WmFirstDrawSetWindowPosSeq2, SWP_SHOWWINDOW | SWP_DEFERERASE | SWP_NOSIZE, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq2, SWP_SHOWWINDOW | SWP_DEFERERASE | SWP_NOZORDER, FALSE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOCOPYBITS, TRUE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOCOPYBITS, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOCLIENTMOVE, TRUE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOCLIENTSIZE, TRUE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq4, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOMOVE, TRUE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSIZE, TRUE);
- test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOZORDER, TRUE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq4, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOMOVE, FALSE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSIZE, FALSE);
+ test_msg_setpos(WmFirstDrawSetWindowPosSeq1, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOZORDER, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq2, SWP_SHOWWINDOW | SWP_NOREDRAW, FALSE);
test_msg_setpos(WmFirstDrawSetWindowPosSeq3, SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOCLIENTMOVE, TRUE);
@@ -5216,7 +5216,7 @@ static void test_messages(void)
flush_sequence();
SetWindowPos(hparent, NULL, 0, 0, 100, 100, SWP_SHOWWINDOW);
ok_sequence(WmFirstDrawChildSeq2, /* Expect child to be redrawn */
- "SetWindowPos:show_popup_first_show_window_child2", TRUE);
+ "SetWindowPos:show_popup_first_show_window_child2", FALSE);
DestroyWindow(hchild);
DestroyWindow(hparent);
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 2fa194f..a6c2ce1 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
(SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER)
#define SWP_AGG_STATUSFLAGS \
(SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
+#define SWP_AGG_NOCLIENTCHANGE \
+ (SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
#define HAS_DLGFRAME(style,exStyle) \
(((exStyle) & WS_EX_DLGMODALFRAME) || \
@@ -2229,16 +2231,7 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos )
&newWindowRect, &newClientRect, valid_rects ))
return FALSE;
- /* erase parent when hiding or resizing child */
- if (!(orig_flags & SWP_DEFERERASE) &&
- ((orig_flags & SWP_HIDEWINDOW) ||
- (!(orig_flags & SWP_SHOWWINDOW) &&
- (winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOGEOMETRYCHANGE)))
- {
- HWND parent = GetAncestor( winpos->hwnd, GA_PARENT );
- if (!parent || parent == GetDesktopWindow()) parent = winpos->hwnd;
- erase_now( parent, 0 );
- }
+
if( winpos->flags & SWP_HIDEWINDOW )
HideCaret(winpos->hwnd);
@@ -2254,6 +2247,26 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos )
SetForegroundWindow( winpos->hwnd );
}
+ if(!(orig_flags & SWP_DEFERERASE))
+ {
+ /* erase parent when hiding or resizing child */
+ if ((orig_flags & SWP_HIDEWINDOW) ||
+ (!(orig_flags & SWP_SHOWWINDOW) &&
+ (winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOGEOMETRYCHANGE))
+ {
+ HWND parent = GetAncestor( winpos->hwnd, GA_PARENT );
+ if (!parent || parent == GetDesktopWindow()) parent = winpos->hwnd;
+ erase_now( parent, 0 );
+ }
+
+ /* Give newly shown windows a chance to redraw */
+ if(((winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
+ && !(orig_flags & SWP_AGG_NOCLIENTCHANGE) && (orig_flags & SWP_SHOWWINDOW))
+ {
+ erase_now(winpos->hwnd, 0);
+ }
+ }
+
/* And last, send the WM_WINDOWPOSCHANGED message */
TRACE("\tstatus flags = %04x\n", winpos->flags & SWP_AGG_STATUSFLAGS);
More information about the wine-cvs
mailing list