git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@513
7f0cb862-5218-0410-a997-
914c9d46530a
( unsigned int, int, int, int ),
int pollInterval )
{
( unsigned int, int, int, int ),
int pollInterval )
{
+ if( !fgState.JoysticksInitialised )
+ {
+ fgJoystickInit( 0 );
+ fgJoystickInit( 1 );
+ fgState.JoysticksInitialised = GL_TRUE;
+ }
+
SET_CALLBACK( Joystick );
fgStructure.Window->State.JoystickPollRate = pollInterval;
SET_CALLBACK( Joystick );
fgStructure.Window->State.JoystickPollRate = pollInterval;
72, /* GameModeRefresh */
GLUT_ACTION_EXIT, /* ActionOnWindowClose */
GLUT_EXEC_STATE_INIT, /* ExecState */
72, /* GameModeRefresh */
GLUT_ACTION_EXIT, /* ActionOnWindowClose */
GLUT_EXEC_STATE_INIT, /* ExecState */
+ NULL, /* ProgramName */
+ GL_FALSE /* JoysticksInitialised */
-#if !TARGET_HOST_WINCE
- fgJoystickInit( 0 );
- fgJoystickInit( 1 );
-#endif /* !TARGET_HOST_WINCE */
-
fgState.Initialised = GL_TRUE;
}
fgState.Initialised = GL_TRUE;
}
+ if ( fgState.JoysticksInitialised )
+ fgJoystickClose( );
#endif /* !TARGET_HOST_WINCE */
#endif /* !TARGET_HOST_WINCE */
+ fgState.JoysticksInitialised = GL_FALSE;
fgState.Initialised = GL_FALSE;
fgState.Initialised = GL_FALSE;
typedef struct tagSFG_Time SFG_Time;
struct tagSFG_Time
{
typedef struct tagSFG_Time SFG_Time;
struct tagSFG_Time
{
+#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
DWORD Value;
#else
struct timeval Value;
DWORD Value;
#else
struct timeval Value;
fgExecutionState ExecState; /* Used for GLUT termination */
char *ProgramName; /* Name of the invoking program */
fgExecutionState ExecState; /* Used for GLUT termination */
char *ProgramName; /* Name of the invoking program */
+ GLboolean JoysticksInitialised; /* Only initialize if application calls for them */
};
/* The structure used by display initialization in freeglut_init.c */
};
/* The structure used by display initialization in freeglut_init.c */
+ RECT winRect;
+ int x, y, w, h;
/*
* For windowed mode, get the current position of the
/*
* For windowed mode, get the current position of the
* decorations into account.
*/
* decorations into account.
*/
- GetWindowRect( window->Window.Handle, &rect );
- rect.right = rect.left + width;
- rect.bottom = rect.top + height;
+ /* "GetWindowRect" returns the pixel coordinates of the outside of the window */
+ GetWindowRect( window->Window.Handle, &winRect );
+ x = winRect.left;
+ y = winRect.top;
+ w = width;
+ h = height;
if ( window->Parent == NULL )
{
if ( ! window->IsMenu && !window->State.IsGameMode )
{
if ( window->Parent == NULL )
{
if ( ! window->IsMenu && !window->State.IsGameMode )
{
- rect.right += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
- rect.bottom += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 +
- GetSystemMetrics( SM_CYCAPTION );
+ w += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
+ h += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 +
+ GetSystemMetrics( SM_CYCAPTION );
- GetWindowRect( window->Parent->Window.Handle, &rect );
- AdjustWindowRect ( &rect, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
- WS_CLIPCHILDREN, FALSE );
+ RECT parentRect;
+ GetWindowRect( window->Parent->Window.Handle, &parentRect );
+ x -= parentRect.left + GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
+ y -= parentRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) * 2 +
+ GetSystemMetrics( SM_CYCAPTION );
SetWindowPos( window->Window.Handle,
HWND_TOP,
SetWindowPos( window->Window.Handle,
HWND_TOP,
- rect.left,
- rect.top,
- rect.right - rect.left,
- rect.bottom - rect.top,
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
SWP_NOZORDER
);
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
SWP_NOZORDER
);