The attached C sample demonstrates two problems with using 
ShowWindow(hwnd,SW_SHOWMINIMIZED) to minimise a top level window. The tests 
were done in KDE, but the second problem has been confirmed in Gnome and I 
suspect the first also occurs there.

1. If you start this program without arguments and click on the resulting
    window it will correctly minimise, but when restored it will appear with
    size 32x32 in the lower left hand corner of the screen (that is, as if it
    were still minimised as an icon).

2. If you start this program with any argument, the window will not appear
    at all. It should appear minimised.

The first problem can be fixed by the attached hack (presumably this is not 
the correct fix or even anything approximating a correct fix). The second 
seems hairier and my best guess is that it happens that way because the 
window manager has not mapped the window yet.
-- 
Troy Rollo - [EMAIL PROTECTED]
#define STRICT
#include <windows.h>
#include <windowsx.h>

LRESULT WINAPI
WndProc(	HWND hWnd,
		UINT wMsg,
		WPARAM wParam,
		LPARAM lParam)
{
	switch(wMsg)
	{
	case WM_LBUTTONDOWN:
		ShowWindow(hWnd, SW_SHOWMINIMIZED);
		return 0;

	case WM_RBUTTONDOWN:
		ShowWindow(hWnd, SW_MINIMIZE);
		return 0;

	case WM_PAINT:
		return 0;

	case WM_CLOSE:
		DestroyWindow(hWnd);
		PostQuitMessage(0);
		return 0;
	}
	return DefWindowProc(hWnd, wMsg, wParam, lParam);
}

int WINAPI
WinMain(	HINSTANCE hInstance,
		HINSTANCE hInstancePrev,
		LPSTR lpCmdLine,
		int nCmdShow)
{
	WNDCLASS wndclass;
	MSG	msg;
	HWND	hwnd;

	memset(&wndclass, 0, sizeof(wndclass));

	wndclass.style = 0;
	wndclass.lpfnWndProc = WndProc;
	wndclass.cbClsExtra = 0;
	wndclass.cbWndExtra = 0;
	wndclass.hInstance = hInstance;
	wndclass.hIcon = 0;
	wndclass.hbrBackground = GetStockBrush(WHITE_BRUSH);
	wndclass.lpszClassName = "MinimizeTest";

	RegisterClass(&wndclass);

	hwnd = 	CreateWindow(	"MinimizeTest",
				"Right or Left Click to Minimize",
				WS_OVERLAPPEDWINDOW | WS_VSCROLL,
				CW_USEDEFAULT, 0,
				CW_USEDEFAULT, 0,
				0,
				0,
				hInstance,
				0);

	if (*lpCmdLine)
		ShowWindow(hwnd, SW_SHOWMINIMIZED);
	else
		ShowWindow(hwnd, SW_SHOW);

	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return 0;
}
diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c
diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c
index 5fdde83..442c428 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -961,7 +961,8 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c
             if( !(style & WS_MINIMIZE) )
 		 swp |= WINPOS_MinMaximize( hwnd, SW_MINIMIZE, &newPos );
             else swp |= SWP_NOSIZE | SWP_NOMOVE;
-	    break;
+	    return TRUE;
+	    // break;
 
 	case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
             swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;


Reply via email to