Joe Krahn's changes to "TARGET_HOST" defined constants

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@698 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2006-09-21 18:39:09 +00:00
parent 22deb0baa1
commit ad0d735b7f
17 changed files with 309 additions and 256 deletions

View File

@ -1196,3 +1196,6 @@ instead of the menu's parent window
(309) Added some handy comments, spacing, fixed a typo in a comment (309) Added some handy comments, spacing, fixed a typo in a comment
(310) Changed "TARGET_HOST_UNIX_X11" to "TARGET_HOST_POSIX_X11" to avoid
trademark issues, per Joe Krahn; also rationalized the other "TARGET_HOST"
definitions

View File

@ -28,7 +28,7 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "freeglut_internal.h" #include "freeglut_internal.h"
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#endif #endif
@ -43,7 +43,7 @@
/* -- PRIVATE FUNCTIONS --------------------------------------------------- */ /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* A factory method for an empty cursor * A factory method for an empty cursor
*/ */
@ -111,7 +111,7 @@ static cursorCacheEntry cursorCache[] = {
*/ */
void fgSetCursor ( SFG_Window *window, int cursorID ) void fgSetCursor ( SFG_Window *window, int cursorID )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
{ {
Cursor cursor; Cursor cursor;
/* /*
@ -156,7 +156,7 @@ void fgSetCursor ( SFG_Window *window, int cursorID )
} }
} }
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
/* /*
* This is a temporary solution only... * This is a temporary solution only...
@ -234,7 +234,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XWarpPointer( XWarpPointer(
fgDisplay.Display, fgDisplay.Display,
@ -246,7 +246,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
/* Make the warp visible immediately. */ /* Make the warp visible immediately. */
XFlush( fgDisplay.Display ); XFlush( fgDisplay.Display );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
{ {
POINT coords; POINT coords;

View File

@ -52,9 +52,9 @@ void FGAPIENTRY glutSwapBuffers( void )
if( ! fgStructure.CurrentWindow->Window.DoubleBuffered ) if( ! fgStructure.CurrentWindow->Window.DoubleBuffered )
return; return;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
glXSwapBuffers( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); glXSwapBuffers( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
SwapBuffers( fgStructure.CurrentWindow->Window.Device ); SwapBuffers( fgStructure.CurrentWindow->Window.Device );
#endif #endif

View File

@ -104,9 +104,9 @@ static GLUTproc fghGetProcAddress( const char* procName )
CHECK_NAME(glutWindowStatusFunc); CHECK_NAME(glutWindowStatusFunc);
CHECK_NAME(glutKeyboardUpFunc); CHECK_NAME(glutKeyboardUpFunc);
CHECK_NAME(glutSpecialUpFunc); CHECK_NAME(glutSpecialUpFunc);
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
CHECK_NAME(glutJoystickFunc); CHECK_NAME(glutJoystickFunc);
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
CHECK_NAME(glutSetColor); CHECK_NAME(glutSetColor);
CHECK_NAME(glutGetColor); CHECK_NAME(glutGetColor);
CHECK_NAME(glutCopyColormap); CHECK_NAME(glutCopyColormap);
@ -147,13 +147,13 @@ static GLUTproc fghGetProcAddress( const char* procName )
CHECK_NAME(glutReportErrors); CHECK_NAME(glutReportErrors);
CHECK_NAME(glutIgnoreKeyRepeat); CHECK_NAME(glutIgnoreKeyRepeat);
CHECK_NAME(glutSetKeyRepeat); CHECK_NAME(glutSetKeyRepeat);
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
CHECK_NAME(glutForceJoystickFunc); CHECK_NAME(glutForceJoystickFunc);
CHECK_NAME(glutGameModeString); CHECK_NAME(glutGameModeString);
CHECK_NAME(glutEnterGameMode); CHECK_NAME(glutEnterGameMode);
CHECK_NAME(glutLeaveGameMode); CHECK_NAME(glutLeaveGameMode);
CHECK_NAME(glutGameModeGet); CHECK_NAME(glutGameModeGet);
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
/* freeglut extensions */ /* freeglut extensions */
CHECK_NAME(glutMainLoopEvent); CHECK_NAME(glutMainLoopEvent);
CHECK_NAME(glutLeaveMainLoop); CHECK_NAME(glutLeaveMainLoop);
@ -208,9 +208,9 @@ glutGetProcAddress( const char *procName )
return p; return p;
/* Try core GL functions */ /* Try core GL functions */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
return(GLUTproc)wglGetProcAddress( ( LPCSTR )procName ); return(GLUTproc)wglGetProcAddress( ( LPCSTR )procName );
#elif TARGET_HOST_UNIX_X11 && defined( GLX_ARB_get_proc_address ) #elif TARGET_HOST_POSIX_X11 && defined( GLX_ARB_get_proc_address )
return(GLUTproc)glXGetProcAddressARB( ( const GLubyte * )procName ); return(GLUTproc)glXGetProcAddressARB( ( const GLubyte * )procName );
#else #else
return NULL; return NULL;

View File

@ -46,7 +46,7 @@
*/ */
static void fghRememberState( void ) static void fghRememberState( void )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* This highly depends on the XFree86 extensions, * This highly depends on the XFree86 extensions,
@ -101,7 +101,7 @@ static void fghRememberState( void )
*/ */
# endif # endif
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
/* DEVMODE devMode; */ /* DEVMODE devMode; */
@ -125,7 +125,7 @@ static void fghRememberState( void )
*/ */
static void fghRestoreState( void ) static void fghRestoreState( void )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
# ifdef X_XF86VidModeGetAllModeLines # ifdef X_XF86VidModeGetAllModeLines
/* Restore the remembered pointer position: */ /* Restore the remembered pointer position: */
@ -202,7 +202,7 @@ static void fghRestoreState( void )
*/ */
# endif # endif
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
/* Restore the previously rememebered desktop display settings */ /* Restore the previously rememebered desktop display settings */
ChangeDisplaySettings( &fgDisplay.DisplayMode, 0 ); ChangeDisplaySettings( &fgDisplay.DisplayMode, 0 );
@ -210,7 +210,7 @@ static void fghRestoreState( void )
#endif #endif
} }
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#ifdef X_XF86VidModeGetAllModeLines #ifdef X_XF86VidModeGetAllModeLines
/* /*
@ -257,7 +257,7 @@ static int fghCheckDisplayModes( GLboolean exactMatch, int displayModesCount, XF
static GLboolean fghChangeDisplayMode( GLboolean haveToTest ) static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
{ {
GLboolean success = GL_FALSE; GLboolean success = GL_FALSE;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* This highly depends on the XFree86 extensions, * This highly depends on the XFree86 extensions,
@ -316,7 +316,7 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
# endif # endif
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
DEVMODE devMode; DEVMODE devMode;
char *fggmstr = NULL; char *fggmstr = NULL;
@ -439,7 +439,7 @@ int FGAPIENTRY glutEnterGameMode( void )
fgStructure.GameModeWindow->State.IsGameMode = GL_TRUE; fgStructure.GameModeWindow->State.IsGameMode = GL_TRUE;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* Sync needed to avoid a real race, the Xserver must have really created * Sync needed to avoid a real race, the Xserver must have really created
@ -546,7 +546,7 @@ void FGAPIENTRY glutLeaveGameMode( void )
fgAddToWindowDestroyList( fgStructure.GameModeWindow ); fgAddToWindowDestroyList( fgStructure.GameModeWindow );
fgStructure.GameModeWindow = NULL; fgStructure.GameModeWindow = NULL;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XUngrabPointer( fgDisplay.Display, CurrentTime ); XUngrabPointer( fgDisplay.Display, CurrentTime );
XUngrabKeyboard( fgDisplay.Display, CurrentTime ); XUngrabKeyboard( fgDisplay.Display, CurrentTime );

View File

@ -42,7 +42,7 @@
#include "freeglut_internal.h" #include "freeglut_internal.h"
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
struct freeglutStrokeFont struct freeglutStrokeFont
{ {

View File

@ -65,7 +65,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
0, /* FPSInterval */ 0, /* FPSInterval */
0, /* SwapCount */ 0, /* SwapCount */
0, /* SwapTime */ 0, /* SwapTime */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
{ 0, GL_FALSE }, /* Time */ { 0, GL_FALSE }, /* Time */
#else #else
{ { 0, 0 }, GL_FALSE }, { { 0, 0 }, GL_FALSE },
@ -94,7 +94,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
*/ */
static void fghInitialize( const char* displayName ) static void fghInitialize( const char* displayName )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
fgDisplay.Display = XOpenDisplay( displayName ); fgDisplay.Display = XOpenDisplay( displayName );
if( fgDisplay.Display == NULL ) if( fgDisplay.Display == NULL )
@ -137,7 +137,7 @@ static void fghInitialize( const char* displayName )
FALSE FALSE
); );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
WNDCLASS wc; WNDCLASS wc;
ATOM atom; ATOM atom;
@ -165,12 +165,12 @@ static void fghInitialize( const char* displayName )
wc.hInstance = fgDisplay.Instance; wc.hInstance = fgDisplay.Instance;
wc.hIcon = LoadIcon( fgDisplay.Instance, _T("GLUT_ICON") ); wc.hIcon = LoadIcon( fgDisplay.Instance, _T("GLUT_ICON") );
#if TARGET_HOST_WIN32 #if defined(_WIN32_WCE)
wc.style = CS_HREDRAW | CS_VREDRAW;
#else
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
if (!wc.hIcon) if (!wc.hIcon)
wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); wc.hIcon = LoadIcon( NULL, IDI_WINLOGO );
#else /* TARGET_HOST_WINCE */
wc.style = CS_HREDRAW | CS_VREDRAW;
#endif #endif
wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hCursor = LoadCursor( NULL, IDC_ARROW );
@ -225,7 +225,7 @@ void fgDeinitialize( void )
/* If there was a menu created, destroy the rendering context */ /* If there was a menu created, destroy the rendering context */
if( fgStructure.MenuContext ) if( fgStructure.MenuContext )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* Note that the MVisualInfo is not owned by the MenuContext! */ /* Note that the MVisualInfo is not owned by the MenuContext! */
glXDestroyContext( fgDisplay.Display, fgStructure.MenuContext->MContext ); glXDestroyContext( fgDisplay.Display, fgStructure.MenuContext->MContext );
#endif #endif
@ -247,13 +247,13 @@ void fgDeinitialize( void )
free( timer ); free( timer );
} }
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
if ( fgState.JoysticksInitialised ) if ( fgState.JoysticksInitialised )
fgJoystickClose( ); fgJoystickClose( );
if ( fgState.InputDevsInitialised ) if ( fgState.InputDevsInitialised )
fgInputDeviceClose( ); fgInputDeviceClose( );
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
fgState.JoysticksInitialised = GL_FALSE; fgState.JoysticksInitialised = GL_FALSE;
fgState.InputDevsInitialised = GL_FALSE; fgState.InputDevsInitialised = GL_FALSE;
@ -304,7 +304,7 @@ void fgDeinitialize( void )
fgState.ProgramName = NULL; fgState.ProgramName = NULL;
} }
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* Make sure all X-client data we have created will be destroyed on * Make sure all X-client data we have created will be destroyed on
@ -318,7 +318,7 @@ void fgDeinitialize( void )
*/ */
XCloseDisplay( fgDisplay.Display ); XCloseDisplay( fgDisplay.Display );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
/* Reset the timer granularity */ /* Reset the timer granularity */
timeEndPeriod ( 1 ); timeEndPeriod ( 1 );
@ -332,7 +332,7 @@ void fgDeinitialize( void )
* Everything inside the following #ifndef is copied from the X sources. * Everything inside the following #ifndef is copied from the X sources.
*/ */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
/* /*
@ -527,7 +527,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
fgElapsedTime( ); fgElapsedTime( );
/* check if GLUT_FPS env var is set */ /* check if GLUT_FPS env var is set */
#if !TARGET_HOST_WINCE #ifndef _WIN32_WCE
{ {
const char *fps = getenv( "GLUT_FPS" ); const char *fps = getenv( "GLUT_FPS" );
if( fps ) if( fps )
@ -619,7 +619,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
argv[ i ] = argv[ j ]; argv[ i ] = argv[ j ];
} }
#endif /* TARGET_HOST_WINCE */ #endif /* _WIN32_WCE */
/* /*
* Have the display created now. If there wasn't a "-display" * Have the display created now. If there wasn't a "-display"
@ -826,59 +826,59 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
case 20 : /* "win32pdf": (incorrect spelling but was there before */ case 20 : /* "win32pdf": (incorrect spelling but was there before */
case 21 : /* "win32pfd": matches the Win32 Pixel Format Descriptor by case 21 : /* "win32pfd": matches the Win32 Pixel Format Descriptor by
number */ number */
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS
#endif #endif
break ; break ;
case 22 : /* "xvisual": matches the X visual ID by number */ case 22 : /* "xvisual": matches the X visual ID by number */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 23 : /* "xstaticgray": */ case 23 : /* "xstaticgray": */
case 29 : /* "xstaticgrey": boolean indicating if the frame buffer case 29 : /* "xstaticgrey": boolean indicating if the frame buffer
configuration's X visual is of type StaticGray */ configuration's X visual is of type StaticGray */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 24 : /* "xgrayscale": */ case 24 : /* "xgrayscale": */
case 30 : /* "xgreyscale": boolean indicating if the frame buffer case 30 : /* "xgreyscale": boolean indicating if the frame buffer
configuration's X visual is of type GrayScale */ configuration's X visual is of type GrayScale */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 25 : /* "xstaticcolor": */ case 25 : /* "xstaticcolor": */
case 31 : /* "xstaticcolour": boolean indicating if the frame buffer case 31 : /* "xstaticcolour": boolean indicating if the frame buffer
configuration's X visual is of type StaticColor */ configuration's X visual is of type StaticColor */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 26 : /* "xpseudocolor": */ case 26 : /* "xpseudocolor": */
case 32 : /* "xpseudocolour": boolean indicating if the frame buffer case 32 : /* "xpseudocolour": boolean indicating if the frame buffer
configuration's X visual is of type PseudoColor */ configuration's X visual is of type PseudoColor */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 27 : /* "xtruecolor": */ case 27 : /* "xtruecolor": */
case 33 : /* "xtruecolour": boolean indicating if the frame buffer case 33 : /* "xtruecolour": boolean indicating if the frame buffer
configuration's X visual is of type TrueColor */ configuration's X visual is of type TrueColor */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 28 : /* "xdirectcolor": */ case 28 : /* "xdirectcolor": */
case 34 : /* "xdirectcolour": boolean indicating if the frame buffer case 34 : /* "xdirectcolour": boolean indicating if the frame buffer
configuration's X visual is of type DirectColor */ configuration's X visual is of type DirectColor */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;
case 35 : /* "borderless": windows should not have borders */ case 35 : /* "borderless": windows should not have borders */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#endif #endif
break ; break ;

View File

@ -35,7 +35,7 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "freeglut_internal.h" #include "freeglut_internal.h"
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#include <errno.h> #include <errno.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/time.h> #include <sys/time.h>
@ -53,7 +53,7 @@ typedef struct {
struct termios termio, termio_save; struct termios termio, termio_save;
} SERIALPORT; } SERIALPORT;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS
#include <sys/types.h> #include <sys/types.h>
#include <winbase.h> #include <winbase.h>
typedef struct { typedef struct {
@ -140,7 +140,7 @@ void fgInitialiseInputDevices ( void )
if( !fgState.InputDevsInitialised ) if( !fgState.InputDevsInitialised )
{ {
dial_device = getenv ( "GLUT_DIALS_SERIAL" ); dial_device = getenv ( "GLUT_DIALS_SERIAL" );
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS
if (!dial_device){ if (!dial_device){
static char devname[256]; static char devname[256];
DWORD size=sizeof(devname); DWORD size=sizeof(devname);
@ -250,7 +250,7 @@ static void poll_dials ( int id )
/******** OS Specific Serial I/O routines *******/ /******** OS Specific Serial I/O routines *******/
#if TARGET_HOST_UNIX_X11 /* ==> Linux/BSD/UNIX POSIX serial I/O */ #if TARGET_HOST_POSIX_X11 /* ==> Linux/BSD/UNIX POSIX serial I/O */
static SERIALPORT *serial_open ( const char *device ) static SERIALPORT *serial_open ( const char *device )
{ {
int fd; int fd;
@ -313,7 +313,7 @@ static void serial_flush ( SERIALPORT *port )
tcflush ( port->fd, TCIOFLUSH ); tcflush ( port->fd, TCIOFLUSH );
} }
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS
static SERIALPORT *serial_open(const char *device){ static SERIALPORT *serial_open(const char *device){
HANDLE fh; HANDLE fh;

View File

@ -37,44 +37,71 @@
#define VERSION_MINOR 4 #define VERSION_MINOR 4
#define VERSION_PATCH 0 #define VERSION_PATCH 0
/* Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */ /* Freeglut is intended to function under all Unix/X11 and Win32 platforms. */
#if defined(_WIN32_WCE) /* XXX: Don't all MS-Windows compilers (except Cygwin) have _WIN32 defined?
# define TARGET_HOST_UNIX_X11 0 * XXX: If so, remove the first set of defined()'s below.
# define TARGET_HOST_WIN32 0 */
# define TARGET_HOST_WINCE 1 #if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__) \
#elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(_WIN32) || defined(_WIN32_WCE) \
# define TARGET_HOST_UNIX_X11 0 || ( defined(__CYGWIN__) && defined(X_DISPLAY_MISSING) )
# define TARGET_HOST_WIN32 1 # define TARGET_HOST_MS_WINDOWS 1
# define TARGET_HOST_WINCE 0
#elif defined(__posix__) || defined(__unix__) || defined(__linux__)
# define TARGET_HOST_POSIX_X11 1
/* FIXME: no Macintosh support?
#if ...
# define TARGET_HOST_MAC_OSX 1
#else #else
# define TARGET_HOST_UNIX_X11 1 # error "Unrecognized target host!"
# define TARGET_HOST_WIN32 0 */
# define TARGET_HOST_WINCE 0
#endif #endif
#ifndef TARGET_HOST_MS_WINDOWS
# define TARGET_HOST_MS_WINDOWS 0
#endif
#ifndef TARGET_HOST_POSIX_X11
# define TARGET_HOST_POSIX_X11 0
#endif
#ifndef TARGET_HOST_MAC_OSX
# define TARGET_HOST_MAC_OSX 0
#endif
/* -- FIXED CONFIGURATION LIMITS ------------------------------------------- */
#define FREEGLUT_MAX_MENUS 3 #define FREEGLUT_MAX_MENUS 3
/* Somehow all Win32 include headers depend on this one: */ /* -- PLATFORM-SPECIFIC INCLUDES ------------------------------------------- */
#if TARGET_HOST_WIN32
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <TCHAR.H>
/* TODO: MinGW is lacking a prototype, this should better be handled via autoconf! */ /* All Win32 headers depend on the huge Windows.h recursive include.
#ifndef ChangeDisplaySettingsEx * Note: Let's use proper case for MS-Win headers. Even though it's
LONG WINAPI ChangeDisplaySettingsExA(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID); * not required due to case insensitivity, it's a good habit to keep
LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); * because the cross-platform includes are case sensitive.
#ifdef UNICODE */
#define ChangeDisplaySettingsEx ChangeDisplaySettingsExW #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
#else # include <Windows.h>
#define ChangeDisplaySettingsEx ChangeDisplaySettingsExA # include <WindowsX.h>
#endif # include <MMSystem.h>
#endif /* CYGWIN does not have tchar.h, but has TEXT(x), defined in winnt.h. */
#endif # ifndef __CYGWIN__
# include <tchar.h>
# else
# define _TEXT(x) TEXT(x)
# define _T(x) TEXT(x)
# endif
#elif TARGET_HOST_POSIX_X11
# include <GL/glx.h>
# include <X11/Xlib.h>
# include <X11/Xatom.h>
# include <X11/keysym.h>
# include <X11/extensions/XInput.h>
# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
# include <X11/extensions/xf86vmode.h>
# endif
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define strdup _strdup
#endif #endif
/* These files should be available on every platform. */ /* These files should be available on every platform. */
@ -95,27 +122,52 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
# include <time.h> # include <time.h>
#else #elif HAVE_SYS_TIME_H
# if HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
# else #else
# include <time.h> # include <time.h>
#endif
/* -- AUTOCONF HACKS --------------------------------------------------------*/
/* XXX: Update autoconf to avoid these.
* XXX: Are non-POSIX platforms intended not to use autoconf?
* If so, perhaps there should be a config_guess.h for them. Alternatively,
* config guesses could be placed above, just after the config.h exclusion.
*/
#if defined(__FreeBSD__) || defined(__NetBSD__)
# define HAVE_USB_JS 1
# if defined(__NetBSD__) || ( defined(__FreeBSD__) && __FreeBSD_version >= 500000)
# define HAVE_USBHID_H 1
# endif # endif
#endif #endif
/* The system-dependant include files should go here: */ #if TARGET_HOST_MS_WINDOWS
#if TARGET_HOST_UNIX_X11 # define HAVE_VPRINTF 1
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
#include <X11/extensions/xf86vmode.h>
#endif
#endif #endif
/* Microsoft VisualC++ 5.0's <math.h> does not define the PI */ #if !defined(HAVE_VPRINTF) && !defined(HAVE_DOPRNT)
/* XXX warning directive here? */
# define HAVE_VPRINTF 1
#endif
/* MinGW may lack a prototype for ChangeDisplaySettingsEx() (depending on the version?) */
#if TARGET_HOST_MS_WINDOWS && !defined(ChangeDisplaySettingsEx)
LONG WINAPI ChangeDisplaySettingsExA(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID);
LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
# ifdef UNICODE
# define ChangeDisplaySettingsEx ChangeDisplaySettingsExW
# else
# define ChangeDisplaySettingsEx ChangeDisplaySettingsExA
# endif
#endif
#if defined(_MSC_VER) || defined(__WATCOMC__)
/* strdup() is non-standard, for all but POSIX-2001 */
#define strdup _strdup
#endif
/* M_PI is non-standard (defined by BSD, not ISO-C) */
#ifndef M_PI #ifndef M_PI
# define M_PI 3.14159265358979323846 # define M_PI 3.14159265358979323846
#endif #endif
@ -198,7 +250,7 @@ struct tagSFG_XYUse
typedef struct tagSFG_Time SFG_Time; typedef struct tagSFG_Time SFG_Time;
struct tagSFG_Time struct tagSFG_Time
{ {
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
DWORD Value; DWORD Value;
#else #else
struct timeval Value; struct timeval Value;
@ -268,7 +320,7 @@ struct tagSFG_State
typedef struct tagSFG_Display SFG_Display; typedef struct tagSFG_Display SFG_Display;
struct tagSFG_Display struct tagSFG_Display
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
Display* Display; /* The display we are being run in. */ Display* Display; /* The display we are being run in. */
int Screen; /* The screen we are about to use. */ int Screen; /* The screen we are about to use. */
Window RootWindow; /* The screen's root window. */ Window RootWindow; /* The screen's root window. */
@ -290,7 +342,7 @@ struct tagSFG_Display
#endif /* X_XF86VidModeGetModeLine */ #endif /* X_XF86VidModeGetModeLine */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
HINSTANCE Instance; /* The application's instance */ HINSTANCE Instance; /* The application's instance */
DEVMODE DisplayMode; /* Desktop's display settings */ DEVMODE DisplayMode; /* Desktop's display settings */
@ -317,12 +369,12 @@ struct tagSFG_Timer
* Make "freeglut" window handle and context types so that we don't need so * Make "freeglut" window handle and context types so that we don't need so
* much conditionally-compiled code later in the library. * much conditionally-compiled code later in the library.
*/ */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
typedef Window SFG_WindowHandleType ; typedef Window SFG_WindowHandleType ;
typedef GLXContext SFG_WindowContextType ; typedef GLXContext SFG_WindowContextType ;
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
typedef HWND SFG_WindowHandleType ; typedef HWND SFG_WindowHandleType ;
typedef HGLRC SFG_WindowContextType ; typedef HGLRC SFG_WindowContextType ;
@ -339,9 +391,9 @@ struct tagSFG_Context
SFG_WindowHandleType Handle; /* The window's handle */ SFG_WindowHandleType Handle; /* The window's handle */
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */ SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XVisualInfo* VisualInfo; /* The window's visual information */ XVisualInfo* VisualInfo; /* The window's visual information */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
HDC Device; /* The window's device context */ HDC Device; /* The window's device context */
#endif #endif
@ -440,7 +492,7 @@ do \
* current window. * current window.
* *
*/ */
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) /* FIXME: also WinCE? */
#define INVOKE_WCB(window,cbname,arg_list) \ #define INVOKE_WCB(window,cbname,arg_list) \
do \ do \
{ \ { \
@ -517,7 +569,7 @@ enum
typedef struct tagSFG_MenuContext SFG_MenuContext; typedef struct tagSFG_MenuContext SFG_MenuContext;
struct tagSFG_MenuContext struct tagSFG_MenuContext
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XVisualInfo* MVisualInfo; /* The window's visual information */ XVisualInfo* MVisualInfo; /* The window's visual information */
#endif #endif
@ -746,12 +798,12 @@ void fgCreateStructure( void );
void fgDestroyStructure( void ); void fgDestroyStructure( void );
/* A helper function to check if a display mode is possible to use */ /* A helper function to check if a display mode is possible to use */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XVisualInfo* fgChooseVisual( void ); XVisualInfo* fgChooseVisual( void );
#endif #endif
/* The window procedure for Win32 events handling */ /* The window procedure for Win32 events handling */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam ); WPARAM wParam, LPARAM lParam );
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,

View File

@ -59,7 +59,7 @@
# include <IOKit/hid/IOHIDLib.h> # include <IOKit/hid/IOHIDLib.h>
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
# define _JS_MAX_AXES 8 # define _JS_MAX_AXES 8
# include <windows.h> # include <windows.h>
# include <mmsystem.h> # include <mmsystem.h>
@ -67,7 +67,7 @@
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
# define _JS_MAX_AXES 16 # define _JS_MAX_AXES 16
# if HAVE_SYS_IOCTL_H # if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h> # include <sys/ioctl.h>
@ -385,14 +385,14 @@ struct tagSFG_Joystick
maxReport[_JS_MAX_AXES]; maxReport[_JS_MAX_AXES];
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
JOYCAPS jsCaps; JOYCAPS jsCaps;
JOYINFOEX js; JOYINFOEX js;
UINT js_id; UINT js_id;
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
# if defined(__FreeBSD__) || defined(__NetBSD__) # if defined(__FreeBSD__) || defined(__NetBSD__)
struct os_specific_s *os; struct os_specific_s *os;
# endif # endif
@ -455,7 +455,7 @@ static SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
*/ */
static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
{ {
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
MMRESULT status; MMRESULT status;
#else #else
int status; int status;
@ -531,7 +531,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
} }
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
status = joyGetPosEx( joy->js_id, &joy->js ); status = joyGetPosEx( joy->js_id, &joy->js );
if ( status != JOYERR_NOERROR ) if ( status != JOYERR_NOERROR )
@ -597,7 +597,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
} }
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
# if defined(__FreeBSD__) || defined(__NetBSD__) # if defined(__FreeBSD__) || defined(__NetBSD__)
if ( joy->os->is_analog ) if ( joy->os->is_analog )
{ {
@ -975,7 +975,7 @@ static void fghJoystickAddHatElement ( SFG_Joystick *joy, CFDictionaryRef button
} }
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
/* Inspired by /* Inspired by
http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp
*/ */
@ -1053,7 +1053,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
CFDictionaryRef props; CFDictionaryRef props;
CFTypeRef topLevelElement; CFTypeRef topLevelElement;
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
# if defined( __FreeBSD__ ) || defined( __NetBSD__ ) # if defined( __FreeBSD__ ) || defined( __NetBSD__ )
char *cp; char *cp;
# endif # endif
@ -1227,7 +1227,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
CFRelease( props ); CFRelease( props );
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
joy->js.dwFlags = JOY_RETURNALL; joy->js.dwFlags = JOY_RETURNALL;
joy->js.dwSize = sizeof( joy->js ); joy->js.dwSize = sizeof( joy->js );
@ -1289,7 +1289,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
} }
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#if defined( __FreeBSD__ ) || defined( __NetBSD__ ) #if defined( __FreeBSD__ ) || defined( __NetBSD__ )
for( i = 0; i < _JS_MAX_AXES; i++ ) for( i = 0; i < _JS_MAX_AXES; i++ )
joy->os->cache_axes[ i ] = 0.0f; joy->os->cache_axes[ i ] = 0.0f;
@ -1535,7 +1535,7 @@ static void fghJoystickInit( int ident )
} }
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
switch( ident ) switch( ident )
{ {
case 0: case 0:
@ -1553,7 +1553,7 @@ static void fghJoystickInit( int ident )
} }
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
# if defined( __FreeBSD__ ) || defined( __NetBSD__ ) # if defined( __FreeBSD__ ) || defined( __NetBSD__ )
fgJoystick[ ident ]->id = ident; fgJoystick[ ident ]->id = ident;
fgJoystick[ ident ]->error = GL_FALSE; fgJoystick[ ident ]->error = GL_FALSE;
@ -1618,11 +1618,11 @@ void fgJoystickClose( void )
close( fgJoystick[ ident ]->hidDev ); close( fgJoystick[ ident ]->hidDev );
#endif #endif
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
/* Do nothing special */ /* Do nothing special */
#endif #endif
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
#if defined( __FreeBSD__ ) || defined( __NetBSD__ ) #if defined( __FreeBSD__ ) || defined( __NetBSD__ )
if( fgJoystick[ident]->os ) if( fgJoystick[ident]->os )
{ {

View File

@ -29,19 +29,15 @@
#include "freeglut_internal.h" #include "freeglut_internal.h"
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#if TARGET_HOST_WIN32 #if HAVE_VPRINTF
# define VFPRINTF(s,f,a) vfprintf((s),(f),(a)) # define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
#else #elif HAVE_DOPRNT
# if HAVE_VPRINTF
# define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
# elif HAVE_DOPRNT
# define VFPRINTF(s,f,a) _doprnt((f),(a),(s)) # define VFPRINTF(s,f,a) _doprnt((f),(a),(s))
# else #else
# define VFPRINTF(s,f,a) # define VFPRINTF(s,f,a)
# endif
#endif #endif
#if TARGET_HOST_WINCE #ifdef _WIN32_WCE
typedef struct GXDisplayProperties GXDisplayProperties; typedef struct GXDisplayProperties GXDisplayProperties;
typedef struct GXKeyList GXKeyList; typedef struct GXKeyList GXKeyList;
@ -55,7 +51,7 @@ GXOPENINPUT GXOpenInput_ = NULL;
struct GXKeyList gxKeyList; struct GXKeyList gxKeyList;
#endif #endif /* _WIN32_WCE */
/* /*
* Try to get the maximum value allowed for ints, falling back to the minimum * Try to get the maximum value allowed for ints, falling back to the minimum
@ -98,13 +94,13 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height )
freeglut_return_if_fail( window != NULL ); freeglut_return_if_fail( window != NULL );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XResizeWindow( fgDisplay.Display, window->Window.Handle, XResizeWindow( fgDisplay.Display, window->Window.Handle,
width, height ); width, height );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
{ {
RECT winRect; RECT winRect;
int x, y, w, h; int x, y, w, h;
@ -158,7 +154,7 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height )
/* /*
* XXX Should update {window->State.OldWidth, window->State.OldHeight} * XXX Should update {window->State.OldWidth, window->State.OldHeight}
* XXX to keep in lockstep with UNIX_X11 code. * XXX to keep in lockstep with POSIX_X11 code.
*/ */
if( FETCH_WCB( *window, Reshape ) ) if( FETCH_WCB( *window, Reshape ) )
INVOKE_WCB( *window, Reshape, ( width, height ) ); INVOKE_WCB( *window, Reshape, ( width, height ) );
@ -225,9 +221,9 @@ static void fghcbDisplayWindow( SFG_Window *window,
{ {
window->State.Redisplay = GL_FALSE; window->State.Redisplay = GL_FALSE;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
fghRedrawWindow ( window ) ; fghRedrawWindow ( window ) ;
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
RedrawWindow( RedrawWindow(
window->Window.Handle, NULL, NULL, window->Window.Handle, NULL, NULL,
RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW
@ -262,9 +258,9 @@ static void fghcbCheckJoystickPolls( SFG_Window *window,
if( window->State.JoystickLastPoll + window->State.JoystickPollRate <= if( window->State.JoystickLastPoll + window->State.JoystickPollRate <=
checkTime ) checkTime )
{ {
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
fgJoystickPollWindow( window ); fgJoystickPollWindow( window );
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
window->State.JoystickLastPoll = checkTime; window->State.JoystickLastPoll = checkTime;
} }
@ -312,7 +308,7 @@ long fgElapsedTime( void )
{ {
if ( fgState.Time.Set ) if ( fgState.Time.Set )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
struct timeval now; struct timeval now;
long elapsed; long elapsed;
@ -322,20 +318,24 @@ long fgElapsedTime( void )
elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000; elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000;
return elapsed; return elapsed;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS
return timeGetTime() - fgState.Time.Value; # if defined(_WIN32_WCE)
#elif TARGET_HOST_WINCE
return GetTickCount() - fgState.Time.Value; return GetTickCount() - fgState.Time.Value;
# else
return timeGetTime() - fgState.Time.Value;
# endif
#endif #endif
} }
else else
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
gettimeofday( &fgState.Time.Value, NULL ); gettimeofday( &fgState.Time.Value, NULL );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS
fgState.Time.Value = timeGetTime (); # if defined(_WIN32_WCE)
#elif TARGET_HOST_WINCE
fgState.Time.Value = GetTickCount(); fgState.Time.Value = GetTickCount();
# else
fgState.Time.Value = timeGetTime ();
# endif
#endif #endif
fgState.Time.Set = GL_TRUE ; fgState.Time.Set = GL_TRUE ;
@ -461,7 +461,7 @@ static void fghSleepForEvents( void )
if( fghHaveJoystick( ) && ( msec > 10 ) ) if( fghHaveJoystick( ) && ( msec > 10 ) )
msec = 10; msec = 10;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* Possibly due to aggressive use of XFlush() and friends, * Possibly due to aggressive use of XFlush() and friends,
* it is possible to have our socket drained but still have * it is possible to have our socket drained but still have
@ -488,12 +488,12 @@ static void fghSleepForEvents( void )
if( ( -1 == err ) && ( errno != EINTR ) ) if( ( -1 == err ) && ( errno != EINTR ) )
fgWarning ( "freeglut select() error: %d", errno ); fgWarning ( "freeglut select() error: %d", errno );
} }
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS ); MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS );
#endif #endif
} }
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* Returns GLUT modifier mask for the state field of an X11 event. * Returns GLUT modifier mask for the state field of an X11 event.
*/ */
@ -513,7 +513,7 @@ static int fghGetXModifiers( int state )
#endif #endif
#if TARGET_HOST_UNIX_X11 && _DEBUG #if TARGET_HOST_POSIX_X11 && _DEBUG
static const char* fghTypeToString( int type ) static const char* fghTypeToString( int type )
{ {
@ -964,7 +964,7 @@ static void fghPrintEvent( XEvent *event )
*/ */
void FGAPIENTRY glutMainLoopEvent( void ) void FGAPIENTRY glutMainLoopEvent( void )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
SFG_Window* window; SFG_Window* window;
XEvent event; XEvent event;
@ -1409,7 +1409,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
} }
} }
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
MSG stMsg; MSG stMsg;
@ -1451,13 +1451,13 @@ void FGAPIENTRY glutMainLoop( void )
{ {
int action; int action;
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
#endif #endif
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoop" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoop" );
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
/* /*
* Processing before the main loop: If there is a window which is open and * Processing before the main loop: If there is a window which is open and
* which has a visibility callback, call it. I know this is an ugly hack, * which has a visibility callback, call it. I know this is an ugly hack,
@ -1536,7 +1536,7 @@ void FGAPIENTRY glutLeaveMainLoop( void )
} }
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
/* /*
* Determine a GLUT modifer mask based on MS-WINDOWS system info. * Determine a GLUT modifer mask based on MS-WINDOWS system info.
*/ */
@ -1584,7 +1584,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
{ {
unsigned int current_DisplayMode = fgState.DisplayMode; unsigned int current_DisplayMode = fgState.DisplayMode;
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH; fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH;
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
#endif #endif
fgState.DisplayMode = current_DisplayMode; fgState.DisplayMode = current_DisplayMode;
@ -1606,7 +1606,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
} }
else else
{ {
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
#endif #endif
@ -1628,7 +1628,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
ReleaseDC( window->Window.Handle, window->Window.Device ); ReleaseDC( window->Window.Handle, window->Window.Device );
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
/* Take over button handling */ /* Take over button handling */
{ {
HINSTANCE dxDllLib=LoadLibrary(_T("gx.dll")); HINSTANCE dxDllLib=LoadLibrary(_T("gx.dll"));
@ -1644,7 +1644,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
gxKeyList = (*GXGetDefaultKeys_)(GX_LANDSCAPEKEYS); gxKeyList = (*GXGetDefaultKeys_)(GX_LANDSCAPEKEYS);
} }
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
break; break;
case WM_SIZE: case WM_SIZE:
@ -1656,13 +1656,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( window->State.Visible ) if( window->State.Visible )
{ {
window->State.NeedToResize = GL_TRUE; window->State.NeedToResize = GL_TRUE;
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
window->State.Width = HIWORD(lParam); window->State.Width = HIWORD(lParam);
window->State.Height = LOWORD(lParam); window->State.Height = LOWORD(lParam);
#else #else
window->State.Width = LOWORD(lParam); window->State.Width = LOWORD(lParam);
window->State.Height = HIWORD(lParam); window->State.Height = HIWORD(lParam);
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
} }
break; break;
@ -1733,13 +1733,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
{ {
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
window->State.MouseX = 320-HIWORD( lParam ); window->State.MouseX = 320-HIWORD( lParam );
window->State.MouseY = LOWORD( lParam ); window->State.MouseY = LOWORD( lParam );
#else #else
window->State.MouseX = LOWORD( lParam ); window->State.MouseX = LOWORD( lParam );
window->State.MouseY = HIWORD( lParam ); window->State.MouseY = HIWORD( lParam );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
/* Restrict to [-32768, 32767] to match X11 behaviour */ /* Restrict to [-32768, 32767] to match X11 behaviour */
/* See comment in "freeglut_developer" mailing list 10/4/04 */ /* See comment in "freeglut_developer" mailing list 10/4/04 */
if ( window->State.MouseX > 32767 ) window->State.MouseX -= 65536; if ( window->State.MouseX > 32767 ) window->State.MouseX -= 65536;
@ -1776,13 +1776,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
GLboolean pressed = GL_TRUE; GLboolean pressed = GL_TRUE;
int button; int button;
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
window->State.MouseX = 320-HIWORD( lParam ); window->State.MouseX = 320-HIWORD( lParam );
window->State.MouseY = LOWORD( lParam ); window->State.MouseY = LOWORD( lParam );
#else #else
window->State.MouseX = LOWORD( lParam ); window->State.MouseX = LOWORD( lParam );
window->State.MouseY = HIWORD( lParam ); window->State.MouseY = HIWORD( lParam );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
/* Restrict to [-32768, 32767] to match X11 behaviour */ /* Restrict to [-32768, 32767] to match X11 behaviour */
/* See comment in "freeglut_developer" mailing list 10/4/04 */ /* See comment in "freeglut_developer" mailing list 10/4/04 */
@ -1821,7 +1821,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break; break;
} }
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
if( GetSystemMetrics( SM_SWAPBUTTON ) ) if( GetSystemMetrics( SM_SWAPBUTTON ) )
{ {
if( button == GLUT_LEFT_BUTTON ) if( button == GLUT_LEFT_BUTTON )
@ -1830,7 +1830,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( button == GLUT_RIGHT_BUTTON ) if( button == GLUT_RIGHT_BUTTON )
button = GLUT_LEFT_BUTTON; button = GLUT_LEFT_BUTTON;
} }
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
if( button == -1 ) if( button == -1 )
return DefWindowProc( hWnd, uMsg, lParam, wParam ); return DefWindowProc( hWnd, uMsg, lParam, wParam );
@ -1998,7 +1998,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
); );
} }
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
if(!(lParam & 0x40000000)) /* Prevent auto-repeat */ if(!(lParam & 0x40000000)) /* Prevent auto-repeat */
{ {
if(wParam==(unsigned)gxKeyList.vkRight) if(wParam==(unsigned)gxKeyList.vkRight)
@ -2086,7 +2086,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
default: default:
{ {
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
BYTE state[ 256 ]; BYTE state[ 256 ];
WORD code[ 2 ]; WORD code[ 2 ];
@ -2099,7 +2099,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
( (char)wParam, ( (char)wParam,
window->State.MouseX, window->State.MouseY ) window->State.MouseX, window->State.MouseY )
); );
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
} }
} }
@ -2159,7 +2159,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
break; break;
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
case WM_SYNCPAINT: /* 0x0088 */ case WM_SYNCPAINT: /* 0x0088 */
/* Another window has moved, need to update this one */ /* Another window has moved, need to update this one */
window->State.Redisplay = GL_TRUE; window->State.Redisplay = GL_TRUE;
@ -2247,7 +2247,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break; break;
} }
} }
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
/* We need to pass the message on to the operating system as well */ /* We need to pass the message on to the operating system as well */
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );

View File

@ -52,7 +52,7 @@
* that that wasn't the original intent...if not, perhaps we need another * that that wasn't the original intent...if not, perhaps we need another
* symbolic constant, FREEGLUT_MENU_ITEM_BORDER, or such.) * symbolic constant, FREEGLUT_MENU_ITEM_BORDER, or such.)
*/ */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
#define FREEGLUT_MENU_FONT GLUT_BITMAP_8_BY_13 #define FREEGLUT_MENU_FONT GLUT_BITMAP_8_BY_13
#else #else
#define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18 #define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18
@ -71,7 +71,7 @@
* too. These variables should be stuffed into global state and initialized * too. These variables should be stuffed into global state and initialized
* via the glutInit*() system. * via the glutInit*() system.
*/ */
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
static float menu_pen_fore [4] = {0.0f, 0.0f, 0.0f, 1.0f}; static float menu_pen_fore [4] = {0.0f, 0.0f, 0.0f, 1.0f};
static float menu_pen_back [4] = {0.85f, 0.85f, 0.85f, 1.0f}; static float menu_pen_back [4] = {0.85f, 0.85f, 0.85f, 1.0f};
static float menu_pen_hfore [4] = {1.0f, 1.0f, 1.0f, 1.0f}; static float menu_pen_hfore [4] = {1.0f, 1.0f, 1.0f, 1.0f};
@ -142,7 +142,7 @@ static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
{ {
if( fgStructure.GameModeWindow ) if( fgStructure.GameModeWindow )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
int wx, wy; int wx, wy;
Window w; Window w;

View File

@ -133,11 +133,11 @@ void FGAPIENTRY glutSetKeyRepeat( int repeatMode )
void FGAPIENTRY glutForceJoystickFunc( void ) void FGAPIENTRY glutForceJoystickFunc( void )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutForceJoystickFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutForceJoystickFunc" );
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
freeglut_return_if_fail( fgStructure.CurrentWindow != NULL ); freeglut_return_if_fail( fgStructure.CurrentWindow != NULL );
freeglut_return_if_fail( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) ); freeglut_return_if_fail( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) );
fgJoystickPollWindow( fgStructure.CurrentWindow ); fgJoystickPollWindow( fgStructure.CurrentWindow );
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
} }
/* /*

View File

@ -45,7 +45,7 @@
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* Queries the GL context about some attributes * Queries the GL context about some attributes
*/ */
@ -124,7 +124,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
*/ */
int FGAPIENTRY glutGet( GLenum eWhat ) int FGAPIENTRY glutGet( GLenum eWhat )
{ {
#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #if TARGET_HOST_MS_WINDOWS
int returnValue ; int returnValue ;
GLboolean boolValue ; GLboolean boolValue ;
#endif #endif
@ -162,7 +162,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* XXX Multisampling. Return what I know about multisampling. */ /* XXX Multisampling. Return what I know about multisampling. */
return 0; return 0;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
/* /*
* The rest of GLX queries under X are general enough to use a macro to * The rest of GLX queries under X are general enough to use a macro to
* check them * check them
@ -277,7 +277,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
return fgStructure.CurrentWindow->Window.VisualInfo->visualid; return fgStructure.CurrentWindow->Window.VisualInfo->visualid;
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
/* Handle the OpenGL inquiries */ /* Handle the OpenGL inquiries */
case GLUT_WINDOW_RGBA: case GLUT_WINDOW_RGBA:
@ -369,7 +369,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* ...then we've got to correct the results we've just received... */ /* ...then we've got to correct the results we've just received... */
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
if ( ( fgStructure.GameModeWindow != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) && if ( ( fgStructure.GameModeWindow != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) &&
( ! fgStructure.CurrentWindow->IsMenu ) ) ( ! fgStructure.CurrentWindow->IsMenu ) )
{ {
@ -378,7 +378,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ); winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME ); winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
} }
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
switch( eWhat ) switch( eWhat )
{ {
@ -391,33 +391,33 @@ int FGAPIENTRY glutGet( GLenum eWhat )
break; break;
case GLUT_WINDOW_BORDER_WIDTH : case GLUT_WINDOW_BORDER_WIDTH :
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
return 0; return 0;
#else #else
return GetSystemMetrics( SM_CXSIZEFRAME ); return GetSystemMetrics( SM_CXSIZEFRAME );
#endif /* !TARGET_HOST_WINCE */ #endif /* !defined(_WIN32_WCE) */
case GLUT_WINDOW_HEADER_HEIGHT : case GLUT_WINDOW_HEADER_HEIGHT :
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
return 0; return 0;
#else #else
return GetSystemMetrics( SM_CYCAPTION ); return GetSystemMetrics( SM_CYCAPTION );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
case GLUT_DISPLAY_MODE_POSSIBLE: case GLUT_DISPLAY_MODE_POSSIBLE:
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
return GL_FALSE; return GL_FALSE;
#else #else
return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE, return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
PFD_MAIN_PLANE ); PFD_MAIN_PLANE );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
case GLUT_WINDOW_FORMAT_ID: case GLUT_WINDOW_FORMAT_ID:
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
if( fgStructure.CurrentWindow != NULL ) if( fgStructure.CurrentWindow != NULL )
return GetPixelFormat( fgStructure.CurrentWindow->Window.Device ); return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
return 0; return 0;
#endif #endif
@ -486,7 +486,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
*/ */
return TRUE ; return TRUE ;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
case GLUT_HAS_MOUSE: case GLUT_HAS_MOUSE:
return TRUE ; return TRUE ;
@ -513,7 +513,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
*/ */
return 3 ; return 3 ;
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
case GLUT_HAS_MOUSE: case GLUT_HAS_MOUSE:
/* /*
@ -524,11 +524,11 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
case GLUT_NUM_MOUSE_BUTTONS: case GLUT_NUM_MOUSE_BUTTONS:
/* We are much more fortunate under Win32 about this... */ /* We are much more fortunate under Win32 about this... */
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
return 1; return 1;
#else #else
return GetSystemMetrics( SM_CMOUSEBUTTONS ); return GetSystemMetrics( SM_CMOUSEBUTTONS );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
#endif #endif
@ -612,7 +612,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
switch( eWhat ) switch( eWhat )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
case GLUT_OVERLAY_POSSIBLE: case GLUT_OVERLAY_POSSIBLE:
return FALSE; return FALSE;
@ -638,7 +638,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
case GLUT_OVERLAY_DAMAGED: case GLUT_OVERLAY_DAMAGED:
return -1; return -1;
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
case GLUT_OVERLAY_POSSIBLE: case GLUT_OVERLAY_POSSIBLE:
/* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE, /* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,

View File

@ -81,7 +81,7 @@
static void fghTeapot( GLint grid, GLdouble scale, GLenum type ) static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
{ {
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4; int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4;
#else #else
double p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; double p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
@ -99,7 +99,7 @@ static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
glScaled( 0.5 * scale, 0.5 * scale, 0.5 * scale ); glScaled( 0.5 * scale, 0.5 * scale, 0.5 * scale );
glTranslated( 0.0, 0.0, -1.5 ); glTranslated( 0.0, 0.0, -1.5 );
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
glRotated( 90.0, 1.0, 0.0, 0.0 ); glRotated( 90.0, 1.0, 0.0, 0.0 );
glBegin( GL_TRIANGLE_STRIP ); glBegin( GL_TRIANGLE_STRIP );
@ -163,7 +163,7 @@ static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
glEvalMesh2(type, 0, grid, 0, grid); glEvalMesh2(type, 0, grid, 0, grid);
} }
} }
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
glPopMatrix(); glPopMatrix();
glPopAttrib(); glPopAttrib();

View File

@ -24,7 +24,7 @@
#ifndef FREEGLUT_TEAPOT_DATA_H #ifndef FREEGLUT_TEAPOT_DATA_H
#define FREEGLUT_TEAPOT_DATA_H #define FREEGLUT_TEAPOT_DATA_H
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
/* /*
* Submitted through the kind offices of Daniel Wagner (daniel@ims.tuwien.ac.at) * Submitted through the kind offices of Daniel Wagner (daniel@ims.tuwien.ac.at)
*/ */
@ -2305,7 +2305,7 @@ const int strip_normals[] = {
31, 31, 118, 237, 205, 449, 186, 470, 496, 494, 176, 155, 429, 112, 185, 89, 185, 421, 94, 300, 379, 170, -1 31, 31, 118, 237, 205, 449, 186, 470, 496, 494, 176, 155, 429, 112, 185, 89, 185, 421, 94, 300, 379, 170, -1
}; };
#else /* TARGET_HOST_WINCE */ #else /* defined(_WIN32_WCE) */
/* /*
* Original teapot code copyright follows: * Original teapot code copyright follows:
@ -2422,7 +2422,7 @@ static double tex[2][2][2] =
{ {0.0, 0.0}, {1.0, 0.0} }, { {0.0, 0.0}, {1.0, 0.0} },
{ {0.0, 1.0}, {1.0, 1.0} } { {0.0, 1.0}, {1.0, 1.0} }
}; };
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
#endif /* FREEGLUT_TEAPOT_DATA_H */ #endif /* FREEGLUT_TEAPOT_DATA_H */

View File

@ -28,7 +28,7 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "freeglut_internal.h" #include "freeglut_internal.h"
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
#include <aygshell.h> #include <aygshell.h>
#pragma comment( lib, "Aygshell.lib" ) /* library pragmas are bad */ #pragma comment( lib, "Aygshell.lib" ) /* library pragmas are bad */
@ -43,7 +43,7 @@ static wchar_t* fghWstrFromStr(const char* str)
} }
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
/* /*
* TODO BEFORE THE STABLE RELEASE: * TODO BEFORE THE STABLE RELEASE:
@ -73,7 +73,7 @@ static wchar_t* fghWstrFromStr(const char* str)
/* /*
* Chooses a visual basing on the current display mode settings * Chooses a visual basing on the current display mode settings
*/ */
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XVisualInfo* fgChooseVisual( void ) XVisualInfo* fgChooseVisual( void )
{ {
@ -169,11 +169,11 @@ XVisualInfo* fgChooseVisual( void )
/* /*
* Setup the pixel format for a Win32 window * Setup the pixel format for a Win32 window
*/ */
#if TARGET_HOST_WIN32 #if TARGET_HOST_MS_WINDOWS
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
unsigned char layer_type ) unsigned char layer_type )
{ {
#if TARGET_HOST_WINCE #ifdef _WIN32_WCE
return GL_TRUE; return GL_TRUE;
#else #else
PIXELFORMATDESCRIPTOR* ppfd, pfd; PIXELFORMATDESCRIPTOR* ppfd, pfd;
@ -244,9 +244,9 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
if( checkOnly ) if( checkOnly )
return GL_TRUE; return GL_TRUE;
return SetPixelFormat( window->Window.Device, pixelformat, ppfd ); return SetPixelFormat( window->Window.Device, pixelformat, ppfd );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
} }
#endif #endif /* TARGET_HOST_MS_WINDOWS */
/* /*
* Sets the OpenGL context and the fgStructure "Current Window" pointer to * Sets the OpenGL context and the fgStructure "Current Window" pointer to
@ -254,14 +254,14 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
*/ */
void fgSetWindow ( SFG_Window *window ) void fgSetWindow ( SFG_Window *window )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
if ( window ) if ( window )
glXMakeCurrent( glXMakeCurrent(
fgDisplay.Display, fgDisplay.Display,
window->Window.Handle, window->Window.Handle,
window->Window.Context window->Window.Context
); );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
if( fgStructure.CurrentWindow ) if( fgStructure.CurrentWindow )
ReleaseDC( fgStructure.CurrentWindow->Window.Handle, ReleaseDC( fgStructure.CurrentWindow->Window.Handle,
fgStructure.CurrentWindow->Window.Device ); fgStructure.CurrentWindow->Window.Device );
@ -287,7 +287,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
int x, int y, int w, int h, int x, int y, int w, int h,
GLboolean gameMode, GLboolean isSubWindow ) GLboolean gameMode, GLboolean isSubWindow )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XSetWindowAttributes winAttr; XSetWindowAttributes winAttr;
XTextProperty textProperty; XTextProperty textProperty;
XSizeHints sizeHints; XSizeHints sizeHints;
@ -478,7 +478,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
XMapWindow( fgDisplay.Display, window->Window.Handle ); XMapWindow( fgDisplay.Display, window->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
WNDCLASS wc; WNDCLASS wc;
DWORD flags; DWORD flags;
@ -504,7 +504,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
} }
else else
{ {
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
if ( ( ! isSubWindow ) && ( ! window->IsMenu ) ) if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
{ {
/* /*
@ -516,7 +516,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 + h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 +
GetSystemMetrics( SM_CYCAPTION ); GetSystemMetrics( SM_CYCAPTION );
} }
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
if( ! fgState.Position.Use ) if( ! fgState.Position.Use )
{ {
@ -540,7 +540,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
flags |= WS_POPUP; flags |= WS_POPUP;
exFlags |= WS_EX_TOOLWINDOW; exFlags |= WS_EX_TOOLWINDOW;
} }
#if !TARGET_HOST_WINCE #if !defined(_WIN32_WCE)
else if( window->Parent == NULL ) else if( window->Parent == NULL )
flags |= WS_OVERLAPPEDWINDOW; flags |= WS_OVERLAPPEDWINDOW;
#endif #endif
@ -548,7 +548,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
flags |= WS_CHILD; flags |= WS_CHILD;
} }
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
{ {
wchar_t* wstr = fghWstrFromStr(title); wchar_t* wstr = fghWstrFromStr(title);
@ -584,17 +584,17 @@ void fgOpenWindow( SFG_Window* window, const char* title,
fgDisplay.Instance, fgDisplay.Instance,
(LPVOID) window (LPVOID) window
); );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
if( !( window->Window.Handle ) ) if( !( window->Window.Handle ) )
fgError( "Failed to create a window (%s)!", title ); fgError( "Failed to create a window (%s)!", title );
#if TARGET_HOST_WINCE #if defined(_WIN32_WCE)
ShowWindow( window->Window.Handle, SW_SHOW ); ShowWindow( window->Window.Handle, SW_SHOW );
#else #else
ShowWindow( window->Window.Handle, ShowWindow( window->Window.Handle,
fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW ); fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW );
#endif /* TARGET_HOST_WINCE */ #endif /* defined(_WIN32_WCE) */
UpdateWindow( window->Window.Handle ); UpdateWindow( window->Window.Handle );
ShowCursor( TRUE ); /* XXX Old comments say "hide cursor"! */ ShowCursor( TRUE ); /* XXX Old comments say "hide cursor"! */
@ -618,14 +618,14 @@ void fgOpenWindow( SFG_Window* window, const char* title,
*/ */
void fgCloseWindow( SFG_Window* window ) void fgCloseWindow( SFG_Window* window )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
glXDestroyContext( fgDisplay.Display, window->Window.Context ); glXDestroyContext( fgDisplay.Display, window->Window.Context );
XFree( window->Window.VisualInfo ); XFree( window->Window.VisualInfo );
XDestroyWindow( fgDisplay.Display, window->Window.Handle ); XDestroyWindow( fgDisplay.Display, window->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
/* Make sure we don't close a window with current context active */ /* Make sure we don't close a window with current context active */
if( fgStructure.CurrentWindow == window ) if( fgStructure.CurrentWindow == window )
@ -779,12 +779,12 @@ void FGAPIENTRY glutShowWindow( void )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutShowWindow" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutShowWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutShowWindow" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutShowWindow" );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XMapWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); XMapWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_SHOW ); ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_SHOW );
@ -801,7 +801,7 @@ void FGAPIENTRY glutHideWindow( void )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutHideWindow" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutHideWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutHideWindow" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutHideWindow" );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
if( fgStructure.CurrentWindow->Parent == NULL ) if( fgStructure.CurrentWindow->Parent == NULL )
XWithdrawWindow( fgDisplay.Display, XWithdrawWindow( fgDisplay.Display,
@ -812,7 +812,7 @@ void FGAPIENTRY glutHideWindow( void )
fgStructure.CurrentWindow->Window.Handle ); fgStructure.CurrentWindow->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_HIDE ); ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_HIDE );
@ -830,13 +830,13 @@ void FGAPIENTRY glutIconifyWindow( void )
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutIconifyWindow" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutIconifyWindow" );
fgStructure.CurrentWindow->State.Visible = GL_FALSE; fgStructure.CurrentWindow->State.Visible = GL_FALSE;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.Screen ); fgDisplay.Screen );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_MINIMIZE ); ShowWindow( fgStructure.CurrentWindow->Window.Handle, SW_MINIMIZE );
@ -854,7 +854,7 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetWindowTitle" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetWindowTitle" );
if( ! fgStructure.CurrentWindow->Parent ) if( ! fgStructure.CurrentWindow->Parent )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XTextProperty text; XTextProperty text;
@ -871,18 +871,17 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS
# ifdef _WIN32_WCE
SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
#elif TARGET_HOST_WINCE
{ {
wchar_t* wstr = fghWstrFromStr(title); wchar_t* wstr = fghWstrFromStr(title);
SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr ); SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
free(wstr); free(wstr);
} }
# else
SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
# endif
#endif #endif
} }
} }
@ -897,7 +896,7 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
if( ! fgStructure.CurrentWindow->Parent ) if( ! fgStructure.CurrentWindow->Parent )
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XTextProperty text; XTextProperty text;
@ -914,18 +913,17 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS
# ifdef _WIN32_WCE
SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
#elif TARGET_HOST_WINCE
{ {
wchar_t* wstr = fghWstrFromStr(title); wchar_t* wstr = fghWstrFromStr(title);
SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr ); SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
free(wstr); free(wstr);
} }
# else
SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
# endif
#endif #endif
} }
} }
@ -951,13 +949,13 @@ void FGAPIENTRY glutPositionWindow( int x, int y )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPositionWindow" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPositionWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPositionWindow" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPositionWindow" );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
x, y ); x, y );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
{ {
RECT winRect; RECT winRect;
@ -985,11 +983,11 @@ void FGAPIENTRY glutPushWindow( void )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPushWindow" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPushWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPushWindow" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPushWindow" );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XLowerWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); XLowerWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
SetWindowPos( SetWindowPos(
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
@ -1009,11 +1007,11 @@ void FGAPIENTRY glutPopWindow( void )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPopWindow" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPopWindow" );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPopWindow" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPopWindow" );
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
XRaiseWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); XRaiseWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_MS_WINDOWS
SetWindowPos( SetWindowPos(
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
@ -1034,7 +1032,7 @@ void FGAPIENTRY glutFullScreen( void )
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutFullScreen" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutFullScreen" );
{ {
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_POSIX_X11
int x, y; int x, y;
Window w; Window w;
@ -1064,7 +1062,7 @@ void FGAPIENTRY glutFullScreen( void )
); );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
} }
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) /* FIXME: what about WinCE */
RECT rect; RECT rect;
/* For fullscreen mode, force the top-left corner to 0,0 /* For fullscreen mode, force the top-left corner to 0,0