[PATCH 1/6] user32/tests: Test minimizing an unminimizable window.

Stefan Dösinger stefan at codeweavers.com
Wed Oct 1 08:50:25 CDT 2014


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 | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 90b87cb..938be96 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -862,6 +862,26 @@ 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 },
+    { WM_SETVISIBLE, 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 },
+    { 0 }
+};
 /* CreateWindow (for a child popup window, not initially visible) */
 static const struct message WmCreateChildPopupSeq[] = {
     { HCBT_CREATEWND, hook },
@@ -4391,6 +4411,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)
-- 
1.8.5.5




More information about the wine-patches mailing list