Fabian Maurer : user32: Send WM_NCPAINT and WM_ERASEBKGND when window is shown.
Alexandre Julliard
julliard at winehq.org
Mon Feb 20 15:03:44 CST 2017
Module: wine
Branch: master
Commit: 997d4ef44f0f9e2284f99d7ce9ec135d68b30c7b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=997d4ef44f0f9e2284f99d7ce9ec135d68b30c7b
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>
---
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 0d5aec7..ea5980e 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -4651,7 +4651,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();
@@ -5135,7 +5135,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 */
@@ -5146,7 +5146,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 */
@@ -5157,20 +5157,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);
@@ -5179,12 +5179,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);
@@ -5220,7 +5220,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 d94f5a3..6ed2d95 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