From: Stefan Dösinger Subject: [PATCH 6/7] user32/tests: Test minimizing an unminimizable window. (v2) Message-Id: <1412595782-19231-6-git-send-email-stefan@codeweavers.com> Date: Mon, 6 Oct 2014 13:43:01 +0200 This supersedes patch 106812. version 2: Use HCBT_SETFOCUS instead of WM_SETVISIBLE for a hook message. Allow an extra WM_GETTEXT message to pass in a virtual desktop. This shows that the abesence of a minimization button does not prevent the application from programmatically minimizing the window. KWin and fvwm behave like Windows in this regard, whereas Metacity-based WMs prevent the minimization. On Windows the user can still minimize a window like this with the "Show Desktop" functionality (Win+D, or a button in the taskbar). This difference leads to a real-word problem when d3d9 tries to minimize a fullscreen game window on focus loss. Those windows usually do not have a style that gives them a minimize button. This test shows that this is not d3d9's issue and needs to be handled in winex11.drv or the WMs themselves. My reading of the XIconifyWindow is that the WM can do whatever it wants with the IconicState token, so KWin, fvwm and Metacity behave according to the spec. --- dlls/user32/tests/msg.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 90b87cb..3a81ca7 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -862,6 +862,27 @@ static const struct message WmShowVisMaxPopupSeq[] = { { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, { 0 } }; +/* ShowWindow(SW_MINIMIZE) for an unminimizable popup window */ +static const struct message WmMinUnminimizablePopupSeq[] = { + { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE }, + { HCBT_SETFOCUS, hook|wparam|optional, 0, 0 }, + { WM_KILLFOCUS, sent|optional }, + { WM_GETTEXT, sent|optional }, + { WM_SYNCPAINT, sent|optional }, + { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOCOPYBITS|SWP_STATECHANGED }, + { WM_NCCALCSIZE, sent|wparam, TRUE }, + { WM_NCPAINT, sent|wparam|optional, 1 }, + { WM_GETTEXT, sent|defwinproc|optional }, + { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, + { WM_MOVE, sent|defwinproc }, + { WM_SIZE, sent|defwinproc|wparam, SIZE_MINIMIZED }, + { WM_NCACTIVATE, sent|optional }, + { WM_GETTEXT, sent|defwinproc|optional }, + { WM_ACTIVATE, sent|optional }, + { WM_ACTIVATEAPP, sent|optional }, + { WM_GETTEXT, sent|optional }, + { 0 } +}; /* CreateWindow (for a child popup window, not initially visible) */ static const struct message WmCreateChildPopupSeq[] = { { HCBT_CREATEWND, hook }, @@ -4391,6 +4412,24 @@ static void test_showwindow(void) ok_sequence(WmShowVisMaxPopupSeq, "ShowWindow(SW_SHOWMAXIMIZED):popup", FALSE); DestroyWindow(hwnd); flush_sequence(); + + /* Test 5: + * 1. Create a visible popup window without minimization decoration. + * 2. Minimize it. + */ + trace("calling CreateWindowExA( WS_VISIBLE ) for popup window\n"); + hwnd = CreateWindowExA(0, "TestWindowClass", "Test popup", WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, 0, NULL); + ok (hwnd != 0, "Failed to create popup window\n"); + ok(!IsIconic(hwnd), "window should NOT be iconic\n"); + ok_sequence(WmCreatePopupSeq, "CreateWindow(WS_VISIBLE):popup", FALSE); + + trace("calling ShowWindow( SW_MINIMIZE ) for unminimizable popup window\n"); + ShowWindow(hwnd, SW_MINIMIZE); + ok(IsIconic(hwnd), "window should be iconic\n"); + ok_sequence(WmMinUnminimizablePopupSeq, "ShowWindow(SW_MINIMIZE):popup, unminimizable", FALSE); + DestroyWindow(hwnd); + flush_sequence(); } static void test_sys_menu(void) -- 2.0.4