#include "freeglut_internal.h"
#if defined(_WIN32_WCE)
-#include <aygshell.h>
-#pragma comment( lib, "Aygshell.lib" ) /* library pragmas are bad */
+# include <Aygshell.h>
+# ifdef FREEGLUT_LIB_PRAGMAS
+# pragma comment( lib, "Aygshell.lib" )
+# endif
static wchar_t* fghWstrFromStr(const char* str)
{
return wstr;
}
-
#endif /* defined(_WIN32_WCE) */
/*
* Setup the pixel format for a Win32 window
*/
#if TARGET_HOST_MS_WINDOWS
-/* WRONG-- FIXME */
/* The following include file is available from SGI but is not standard:
* #include <GL/wglext.h>
* So we copy the necessary parts out of it.
+ * XXX: should local definitions for extensions be put in a separate include file?
*/
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
* to the freeglut structure. OpenGL context is created here.
*/
void fgOpenWindow( SFG_Window* window, const char* title,
- int x, int y, int w, int h,
+ GLboolean positionUse, int x, int y,
+ GLboolean sizeUse, int w, int h,
GLboolean gameMode, GLboolean isSubWindow )
{
#if TARGET_HOST_POSIX_X11
{
fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
window->Window.VisualInfo = fgChooseVisual( );
- fgState.DisplayMode &= GLUT_MULTISAMPLE;
+ fgState.DisplayMode |= GLUT_MULTISAMPLE;
}
}
mask |= CWOverrideRedirect;
}
+ if( ! positionUse )
+ x = y = -1; /* default window position */
+ if( ! sizeUse )
+ w = h = 300; /* default window size */
+
window->Window.Handle = XCreateWindow(
fgDisplay.Display,
window->Parent == NULL ? fgDisplay.RootWindow :
window->State.Visible = GL_TRUE;
sizeHints.flags = 0;
- if ( fgState.Position.Use )
+ if ( positionUse )
sizeHints.flags |= USPosition;
- if ( fgState.Size.Use )
+ if ( sizeUse )
sizeHints.flags |= USSize;
/*
}
else
{
+ int worig = w, horig = h;
+
#if !defined(_WIN32_WCE)
if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
{
}
#endif /* defined(_WIN32_WCE) */
- if( ! fgState.Position.Use )
+ if( ! positionUse )
{
x = CW_USEDEFAULT;
y = CW_USEDEFAULT;
}
- if( ! fgState.Size.Use )
+ /* setting State.Width/Height to call resize callback later */
+ if( ! sizeUse )
+ {
+ if( ! window->IsMenu )
+ {
+ w = CW_USEDEFAULT;
+ h = CW_USEDEFAULT;
+ }
+ else /* fail safe - Windows can make a window of size (0, 0) */
+ w = h = 300; /* default window size */
+ window->State.Width = window->State.Height = -1;
+ }
+ else
{
- w = CW_USEDEFAULT;
- h = CW_USEDEFAULT;
+ window->State.Width = worig;
+ window->State.Height = horig;
}
/*
#else
window->Window.Handle = CreateWindowEx(
exFlags,
- "FREEGLUT",
+ _T("FREEGLUT"),
title,
flags,
x, y, w, h,
*/
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" );
- return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y,
- fgState.Size.X, fgState.Size.Y, GL_FALSE,
- GL_FALSE )->ID;
+ return fgCreateWindow( NULL, title, fgState.Position.Use,
+ fgState.Position.X, fgState.Position.Y,
+ fgState.Size.Use, fgState.Size.X, fgState.Size.Y,
+ GL_FALSE, GL_FALSE )->ID;
}
/*
h = -h ;
}
- window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE );
+ window = fgCreateWindow( parent, "", GL_TRUE, x, y, GL_TRUE, w, h, GL_FALSE, GL_FALSE );
ret = window->ID;
return ret;