# define MIN(a,b) (((a)<(b)) ? (a) : (b))\r
#endif\r
\r
-#ifdef WM_TOUCH\r
- typedef BOOL (WINAPI *pGetTouchInputInfo)(HTOUCHINPUT,UINT,PTOUCHINPUT,int);\r
- typedef BOOL (WINAPI *pCloseTouchInputHandle)(HTOUCHINPUT);\r
- static pGetTouchInputInfo fghGetTouchInputInfo = (pGetTouchInputInfo)0xDEADBEEF;\r
- static pCloseTouchInputHandle fghCloseTouchInputHandle = (pCloseTouchInputHandle)0xDEADBEEF;\r
-#endif\r
-\r
-extern void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height );\r
-extern void fghcbPlatformDisplayWindow ( SFG_Window *window );\r
-extern void fghPlatformSleepForEvents( long msec );\r
-extern void fghProcessSingleEvent ( void );\r
-extern void fghMainLoopPreliminaryWork ( void );\r
+extern void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height );\r
+extern void fgPlatformDisplayWindow ( SFG_Window *window );\r
+extern unsigned long fgPlatformSystemTime ( void );\r
+extern void fgPlatformSleepForEvents( long msec );\r
+extern void fgPlatformProcessSingleEvent ( void );\r
+extern void fgPlatformMainLoopPreliminaryWork ( void );\r
\r
\r
/*\r
* match the new window size.\r
*/\r
#if TARGET_HOST_POSIX_X11\r
-static void fghPlatformReshapeWindow ( SFG_Window *window, int width, int height )\r
+void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height )\r
{\r
- XResizeWindow( fgDisplay.Display, window->Window.Handle,\r
+ XResizeWindow( fgDisplay.pDisplay.Display, window->Window.Handle,\r
width, height );\r
- XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */\r
+ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */\r
}\r
#endif\r
\r
\r
freeglut_return_if_fail( window != NULL );\r
\r
- fghPlatformReshapeWindow ( window, width, height );\r
+ fgPlatformReshapeWindow ( window, width, height );\r
\r
if( FETCH_WCB( *window, Reshape ) )\r
INVOKE_WCB( *window, Reshape, ( width, height ) );\r
* A static helper function to execute display callback for a window\r
*/\r
#if TARGET_HOST_POSIX_X11\r
-static void fghcbPlatformDisplayWindow ( SFG_Window *window )\r
+void fgPlatformDisplayWindow ( SFG_Window *window )\r
{\r
fghRedrawWindow ( window ) ;\r
}\r
+\r
+\r
+unsigned long fgPlatformSystemTime ( void )\r
+{\r
+#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY\r
+ struct timeval now;\r
+ gettimeofday( &now, NULL );\r
+ return now.tv_usec/1000 + now.tv_sec*1000;\r
+#endif\r
+}\r
#endif\r
\r
static void fghcbDisplayWindow( SFG_Window *window,\r
window->State.Visible )\r
{\r
window->State.Redisplay = GL_FALSE;\r
- fghcbPlatformDisplayWindow ( window );\r
+ fgPlatformDisplayWindow ( window );\r
}\r
\r
fgEnumSubWindows( window, fghcbDisplayWindow, enumerator );\r
* when subtracting an initial start time, unless the total time exceeds\r
* 32-bit, where the GLUT API return value is also overflowed.\r
*/ \r
-unsigned long fgSystemTime(void) {\r
-#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY\r
- struct timeval now;\r
- gettimeofday( &now, NULL );\r
- return now.tv_usec/1000 + now.tv_sec*1000;\r
-#elif TARGET_HOST_MS_WINDOWS\r
-# if defined(_WIN32_WCE)\r
- return GetTickCount();\r
-# else\r
- return timeGetTime();\r
-# endif\r
-#endif\r
+unsigned long fgSystemTime(void)\r
+{\r
+ return fgPlatformSystemTime ();\r
}\r
\r
/*\r
*/\r
\r
#if TARGET_HOST_POSIX_X11\r
-static void fghPlatformSleepForEvents( long msec )\r
+void fgPlatformSleepForEvents( long msec )\r
{\r
/*\r
* Possibly due to aggressive use of XFlush() and friends,\r
* need to allow that we may have an empty socket but non-\r
* empty event queue.\r
*/\r
- if( ! XPending( fgDisplay.Display ) )\r
+ if( ! XPending( fgDisplay.pDisplay.Display ) )\r
{\r
fd_set fdset;\r
int err;\r
int socket;\r
struct timeval wait;\r
\r
- socket = ConnectionNumber( fgDisplay.Display );\r
+ socket = ConnectionNumber( fgDisplay.pDisplay.Display );\r
FD_ZERO( &fdset );\r
FD_SET( socket, &fdset );\r
wait.tv_sec = msec / 1000;\r
if( fghHaveJoystick( ) && ( msec > 10 ) ) \r
msec = 10;\r
\r
- fghPlatformSleepForEvents ( msec );\r
+ fgPlatformSleepForEvents ( msec );\r
}\r
\r
#if TARGET_HOST_POSIX_X11\r
/*\r
* Returns GLUT modifier mask for the state field of an X11 event.\r
*/\r
-int fghGetModifiers( int state )\r
+int fgPlatformGetModifiers( int state )\r
{\r
int ret = 0;\r
\r
}\r
\r
\r
-void fghProcessSingleEvent ( void )\r
+void fgPlatformProcessSingleEvent ( void )\r
{\r
SFG_Window* window;\r
XEvent event;\r
\r
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoopEvent" );\r
\r
- while( XPending( fgDisplay.Display ) )\r
+ while( XPending( fgDisplay.pDisplay.Display ) )\r
{\r
- XNextEvent( fgDisplay.Display, &event );\r
+ XNextEvent( fgDisplay.pDisplay.Display, &event );\r
#if _DEBUG\r
fghPrintEvent( &event );\r
#endif\r
break;\r
}\r
/* Destroy the window when the WM_DELETE_WINDOW message arrives */\r
- if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow )\r
+ if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.pDisplay.DeleteWindow )\r
{\r
GETWINDOW( xclient );\r
\r
* XXX track ButtonPress/ButtonRelease events in our own\r
* XXX bit-mask?\r
*/\r
- fgState.Modifiers = fghGetModifiers( event.xmotion.state );\r
+ fgState.Modifiers = fgPlatformGetModifiers( event.xmotion.state );\r
if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) {\r
INVOKE_WCB( *window, Motion, ( event.xmotion.x,\r
event.xmotion.y ) );\r
! FETCH_WCB( *window, MouseWheel ) )\r
break;\r
\r
- fgState.Modifiers = fghGetModifiers( event.xbutton.state );\r
+ fgState.Modifiers = fgPlatformGetModifiers( event.xbutton.state );\r
\r
/* Finally execute the mouse or mouse wheel callback */\r
if( ( button < glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS ) ) || ( ! FETCH_WCB( *window, MouseWheel ) ) )\r
*/\r
\r
char keys[32];\r
- XQueryKeymap( fgDisplay.Display, keys ); /* Look at X11 keystate to detect repeat mode */\r
+ XQueryKeymap( fgDisplay.pDisplay.Display, keys ); /* Look at X11 keystate to detect repeat mode */\r
\r
if ( event.xkey.keycode<256 ) /* XQueryKeymap is limited to 256 keycodes */\r
{\r
if( keyboard_cb )\r
{\r
fgSetWindow( window );\r
- fgState.Modifiers = fghGetModifiers( event.xkey.state );\r
+ fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );\r
keyboard_cb( asciiCode[ 0 ],\r
event.xkey.x, event.xkey.y\r
);\r
if( special_cb && (special != -1) )\r
{\r
fgSetWindow( window );\r
- fgState.Modifiers = fghGetModifiers( event.xkey.state );\r
+ fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );\r
special_cb( special, event.xkey.x, event.xkey.y );\r
fgState.Modifiers = INVALID_MODIFIERS;\r
}\r
}\r
\r
\r
-static void fghMainLoopPreliminaryWork ( void )\r
+void fgPlatformMainLoopPreliminaryWork ( void )\r
{\r
}\r
#endif\r
*/\r
void FGAPIENTRY glutMainLoopEvent( void )\r
{\r
- fghProcessSingleEvent ();\r
+ fgPlatformProcessSingleEvent ();\r
\r
if( fgState.Timers.First )\r
fghCheckTimers( );\r
\r
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoop" );\r
\r
- fghMainLoopPreliminaryWork ();\r
+ fgPlatformMainLoopPreliminaryWork ();\r
\r
fgState.ExecState = GLUT_EXEC_STATE_RUNNING ;\r
while( fgState.ExecState == GLUT_EXEC_STATE_RUNNING )\r