/*  GadTools layout toolkit
**
**  Copyright © 1993-1995 by Olaf `Olsen' Barthel
**  Freely distributable.
*/

#include "gtlayout_global.h"

VOID LIBENT
LT_ShowWindow(REG(a0) LayoutHandle *handle,REG(a1) BOOL activate)
{
	if(handle)
	{
		struct Window *window;

		window = handle -> Window;

		WindowToFront(window);

		if(activate)
			ActivateWindow(window);

		ScreenToFront(window -> WScreen);

		if(!handle -> ResizeView && (handle -> Window -> Flags & (WFLG_HASZOOM | WFLG_ZOOMED)) == (WFLG_HASZOOM | WFLG_ZOOMED))
		{
			WORD i;

			ZipWindow(window);

				// wait for the window to unzoom before calling LTP_MoveToWindow()

			for(i = 0 ; i < 300 ; i++)
			{
				if(!handle -> Window -> Flags & WFLG_ZOOMED)
					break;

				WaitTOF();
			}
		}

		LTP_MoveToWindow(handle);
	}
}
