ChangeSet ID: 21187 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/09 04:35:48
Modified files: dlls/x11drv : winpos.c dlls/user/tests: msg.c
Log message: Don't call SetWindowPos in ShowWindow if a parent window is not visible, only toggle the WS_VISIBLE flag.
Patch: http://cvs.winehq.org/patch.py?id=21187
Old revision New revision Changes Path 1.140 1.141 +15 -5 wine/dlls/x11drv/winpos.c 1.100 1.101 +17 -4 wine/dlls/user/tests/msg.c
Index: wine/dlls/x11drv/winpos.c diff -u -p wine/dlls/x11drv/winpos.c:1.140 wine/dlls/x11drv/winpos.c:1.141 --- wine/dlls/x11drv/winpos.c:1.140 9 Nov 2005 10:35:48 -0000 +++ wine/dlls/x11drv/winpos.c 9 Nov 2005 10:35:48 -0000 @@ -1003,12 +1003,22 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c if (!IsWindow( hwnd )) return wasVisible; }
- /* ShowWindow won't activate a not being maximized child window */ - if ((style & WS_CHILD) && cmd != SW_MAXIMIZE) - swp |= SWP_NOACTIVATE | SWP_NOZORDER; + if (!IsWindowVisible( GetAncestor( hwnd, GA_PARENT ))) + { + /* if parent is not visible simply toggle WS_VISIBLE and return */ + if (showFlag) WIN_SetStyle( hwnd, WS_VISIBLE, 0 ); + else WIN_SetStyle( hwnd, 0, WS_VISIBLE ); + } + else + { + /* ShowWindow won't activate a not being maximized child window */ + if ((style & WS_CHILD) && cmd != SW_MAXIMIZE) + swp |= SWP_NOACTIVATE | SWP_NOZORDER; + + SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top, + newPos.right, newPos.bottom, LOWORD(swp) ); + }
- SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top, - newPos.right, newPos.bottom, LOWORD(swp) ); if (cmd == SW_HIDE) { HWND hFocus; Index: wine/dlls/user/tests/msg.c diff -u -p wine/dlls/user/tests/msg.c:1.100 wine/dlls/user/tests/msg.c:1.101 --- wine/dlls/user/tests/msg.c:1.100 9 Nov 2005 10:35:48 -0000 +++ wine/dlls/user/tests/msg.c 9 Nov 2005 10:35:48 -0000 @@ -543,6 +543,15 @@ static const struct message WmDestroyChi { WM_NCDESTROY, sent }, { 0 } }; +/* DestroyWindow for a visible child window with invisible parent */ +static const struct message WmDestroyInvisibleChildSeq[] = { + { HCBT_DESTROYWND, hook }, + { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY }, + { WM_SHOWWINDOW, sent|wparam, 0 }, + { WM_DESTROY, sent }, + { WM_NCDESTROY, sent }, + { 0 } +}; /* Moving the mouse in nonclient area */ static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */ { WM_NCHITTEST, sent }, @@ -2855,14 +2864,14 @@ static void test_showwindow(void) /* ShowWindow(SW_SHOWNA) with child and parent invisible */ trace("calling ShowWindow( SW_SHOWNA) for invisible child with invisible parent\n"); ok( ShowWindow(hchild, SW_SHOWNA) == FALSE, "ShowWindow: window was visible\n" ); - ok_sequence(WmSHOWNAChildInvisParInvis, "ShowWindow(SW_SHOWNA) invisible child and parent", TRUE); + ok_sequence(WmSHOWNAChildInvisParInvis, "ShowWindow(SW_SHOWNA) invisible child and parent", FALSE); trace("done\n"); /* ShowWindow(SW_SHOWNA) with child visible and parent invisible */ ok( ShowWindow(hchild, SW_SHOW) != FALSE, "ShowWindow: window was invisible\n" ); flush_sequence(); trace("calling ShowWindow( SW_SHOWNA) for the visible child and invisible parent\n"); ok( ShowWindow(hchild, SW_SHOWNA) != FALSE, "ShowWindow: window was invisible\n" ); - ok_sequence(WmSHOWNAChildVisParInvis, "ShowWindow(SW_SHOWNA) visible child and invisible parent", TRUE); + ok_sequence(WmSHOWNAChildVisParInvis, "ShowWindow(SW_SHOWNA) visible child and invisible parent", FALSE); trace("done\n"); /* ShowWindow(SW_SHOWNA) with child visible and parent visible */ ShowWindow( hwnd, SW_SHOW); @@ -3176,12 +3185,12 @@ static void test_messages(void) ok_sequence(WmCreateChildSeq, "CreateWindow:child", FALSE);
ShowWindow( hchild, SW_SHOW ); - ok_sequence(WmShowChildInvisibleParentSeq, "ShowWindow:show child with invisible parent", TRUE); + ok_sequence(WmShowChildInvisibleParentSeq, "ShowWindow:show child with invisible parent", FALSE); ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n");
ShowWindow( hchild, SW_HIDE ); - ok_sequence(WmHideChildInvisibleParentSeq, "ShowWindow:hide child with invisible parent", TRUE); + ok_sequence(WmHideChildInvisibleParentSeq, "ShowWindow:hide child with invisible parent", FALSE); ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should be not set\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n");
@@ -3195,7 +3204,11 @@ static void test_messages(void) ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should not be set\n"); ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n");
+ SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); + flush_sequence(); DestroyWindow(hchild); + ok_sequence(WmDestroyInvisibleChildSeq, "DestroyInvisibleChildSeq", FALSE); + DestroyWindow(hparent); flush_sequence();