Joe Krahn's changes to "TARGET_HOST" defined constants
authorJohn F. Fay <johnffay@nettally.com>
Thu, 21 Sep 2006 18:39:09 +0000 (18:39 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Thu, 21 Sep 2006 18:39:09 +0000 (18:39 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@698 7f0cb862-5218-0410-a997-914c9d46530a

17 files changed:
ChangeLog
src/freeglut_cursor.c
src/freeglut_display.c
src/freeglut_ext.c
src/freeglut_gamemode.c
src/freeglut_glutfont_definitions.c
src/freeglut_init.c
src/freeglut_input_devices.c
src/freeglut_internal.h
src/freeglut_joystick.c
src/freeglut_main.c
src/freeglut_menu.c
src/freeglut_misc.c
src/freeglut_state.c
src/freeglut_teapot.c
src/freeglut_teapot_data.h
src/freeglut_window.c

index 41397d5..61ff8d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1196,3 +1196,6 @@ instead of the menu's parent window
 
 (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
index 66ed155..557a9b8 100644 (file)
@@ -28,7 +28,7 @@
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
   #include <X11/cursorfont.h>
 #endif
 
@@ -43,7 +43,7 @@
 
 /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 /*
  * A factory method for an empty cursor
  */
@@ -111,7 +111,7 @@ static cursorCacheEntry cursorCache[] = {
  */
 void fgSetCursor ( SFG_Window *window, int cursorID )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     {
         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...
@@ -234,7 +234,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" );
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" );
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XWarpPointer(
         fgDisplay.Display,
@@ -246,7 +246,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
     /* Make the warp visible immediately. */
     XFlush( fgDisplay.Display );
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     {
         POINT coords;
index 8faa4a5..0626981 100644 (file)
@@ -52,9 +52,9 @@ void FGAPIENTRY glutSwapBuffers( void )
     if( ! fgStructure.CurrentWindow->Window.DoubleBuffered )
         return;
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     glXSwapBuffers( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
     SwapBuffers( fgStructure.CurrentWindow->Window.Device );
 #endif
 
index 875945e..a1d6f59 100644 (file)
@@ -104,9 +104,9 @@ static GLUTproc fghGetProcAddress( const char* procName )
     CHECK_NAME(glutWindowStatusFunc);
     CHECK_NAME(glutKeyboardUpFunc);
     CHECK_NAME(glutSpecialUpFunc);
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
     CHECK_NAME(glutJoystickFunc);
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
     CHECK_NAME(glutSetColor);
     CHECK_NAME(glutGetColor);
     CHECK_NAME(glutCopyColormap);
@@ -147,13 +147,13 @@ static GLUTproc fghGetProcAddress( const char* procName )
     CHECK_NAME(glutReportErrors);
     CHECK_NAME(glutIgnoreKeyRepeat);
     CHECK_NAME(glutSetKeyRepeat);
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
     CHECK_NAME(glutForceJoystickFunc);
     CHECK_NAME(glutGameModeString);
     CHECK_NAME(glutEnterGameMode);
     CHECK_NAME(glutLeaveGameMode);
     CHECK_NAME(glutGameModeGet);
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
     /* freeglut extensions */
     CHECK_NAME(glutMainLoopEvent);
     CHECK_NAME(glutLeaveMainLoop);
@@ -208,9 +208,9 @@ glutGetProcAddress( const char *procName )
         return p;
 
     /* Try core GL functions */
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
     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 );
 #else
     return NULL;
index 5f8faad..d466156 100644 (file)
@@ -46,7 +46,7 @@
  */
 static void fghRememberState( void )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     /*
      * This highly depends on the XFree86 extensions,
@@ -101,7 +101,7 @@ static void fghRememberState( void )
      */
 #   endif
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
 /*    DEVMODE devMode; */
 
@@ -125,7 +125,7 @@ static void fghRememberState( void )
  */
 static void fghRestoreState( void )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
 #   ifdef X_XF86VidModeGetAllModeLines
     /* Restore the remembered pointer position: */
@@ -202,7 +202,7 @@ static void fghRestoreState( void )
      */
 #   endif
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     /* Restore the previously rememebered desktop display settings */
     ChangeDisplaySettings( &fgDisplay.DisplayMode, 0 );
@@ -210,7 +210,7 @@ static void fghRestoreState( void )
 #endif
 }
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #ifdef X_XF86VidModeGetAllModeLines
 
 /*
@@ -257,7 +257,7 @@ static int fghCheckDisplayModes( GLboolean exactMatch, int displayModesCount, XF
 static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
 {
     GLboolean success = GL_FALSE;
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     /*
      * This highly depends on the XFree86 extensions,
@@ -316,7 +316,7 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
 
 #   endif
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     DEVMODE  devMode;
     char *fggmstr = NULL;
@@ -439,7 +439,7 @@ int FGAPIENTRY glutEnterGameMode( void )
 
     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
@@ -546,7 +546,7 @@ void FGAPIENTRY glutLeaveGameMode( void )
     fgAddToWindowDestroyList( fgStructure.GameModeWindow );
     fgStructure.GameModeWindow = NULL;
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XUngrabPointer( fgDisplay.Display, CurrentTime );
     XUngrabKeyboard( fgDisplay.Display, CurrentTime );
index 4dde49f..30a3659 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "freeglut_internal.h"
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
 struct freeglutStrokeFont
 {
index e25b43c..fbf9065 100644 (file)
@@ -65,7 +65,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE },  /* Position */
                       0,                     /* FPSInterval */
                       0,                     /* SwapCount */
                       0,                     /* SwapTime */
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
                       { 0, GL_FALSE },       /* Time */
 #else
                       { { 0, 0 }, GL_FALSE },
@@ -94,7 +94,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE },  /* Position */
  */
 static void fghInitialize( const char* displayName )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     fgDisplay.Display = XOpenDisplay( displayName );
 
     if( fgDisplay.Display == NULL )
@@ -137,7 +137,7 @@ static void fghInitialize( const char* displayName )
         FALSE
     );
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     WNDCLASS wc;
     ATOM atom;
@@ -165,12 +165,12 @@ static void fghInitialize( const char* displayName )
         wc.hInstance      = fgDisplay.Instance;
         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;
         if (!wc.hIcon)
           wc.hIcon        = LoadIcon( NULL, IDI_WINLOGO );
-#else /* TARGET_HOST_WINCE */
-        wc.style          = CS_HREDRAW | CS_VREDRAW;
 #endif
 
         wc.hCursor        = LoadCursor( NULL, IDC_ARROW );
@@ -225,7 +225,7 @@ void fgDeinitialize( void )
     /* If there was a menu created, destroy the rendering context */
     if( fgStructure.MenuContext )
     {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
         /* Note that the MVisualInfo is not owned by the MenuContext! */
         glXDestroyContext( fgDisplay.Display, fgStructure.MenuContext->MContext );
 #endif
@@ -247,13 +247,13 @@ void fgDeinitialize( void )
         free( timer );
     }
 
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
     if ( fgState.JoysticksInitialised )
         fgJoystickClose( );
 
     if ( fgState.InputDevsInitialised )
         fgInputDeviceClose( );
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
     fgState.JoysticksInitialised = GL_FALSE;
     fgState.InputDevsInitialised = GL_FALSE;
 
@@ -304,7 +304,7 @@ void fgDeinitialize( void )
         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
@@ -318,7 +318,7 @@ void fgDeinitialize( void )
      */
     XCloseDisplay( fgDisplay.Display );
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     /* Reset the timer granularity */
     timeEndPeriod ( 1 );
@@ -332,7 +332,7 @@ void fgDeinitialize( void )
  * 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( );
 
     /* check if GLUT_FPS env var is set */
-#if !TARGET_HOST_WINCE
+#ifndef _WIN32_WCE
     {
         const char *fps = getenv( "GLUT_FPS" );
         if( fps )
@@ -619,7 +619,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
             argv[ i ] = argv[ j ];
     }
 
-#endif /* TARGET_HOST_WINCE */
+#endif /* _WIN32_WCE */
 
     /*
      * 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 21 :  /* "win32pfd":  matches the Win32 Pixel Format Descriptor by
                       number */
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS
 #endif
             break ;
 
         case 22 :  /* "xvisual":  matches the X visual ID by number */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 23 :  /* "xstaticgray": */
         case 29 :  /* "xstaticgrey":  boolean indicating if the frame buffer
                       configuration's X visual is of type StaticGray */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 24 :  /* "xgrayscale": */
         case 30 :  /* "xgreyscale":  boolean indicating if the frame buffer
                       configuration's X visual is of type GrayScale */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 25 :  /* "xstaticcolor": */
         case 31 :  /* "xstaticcolour":  boolean indicating if the frame buffer
                       configuration's X visual is of type StaticColor */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 26 :  /* "xpseudocolor": */
         case 32 :  /* "xpseudocolour":  boolean indicating if the frame buffer
                       configuration's X visual is of type PseudoColor */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 27 :  /* "xtruecolor": */
         case 33 :  /* "xtruecolour":  boolean indicating if the frame buffer
                       configuration's X visual is of type TrueColor */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 28 :  /* "xdirectcolor": */
         case 34 :  /* "xdirectcolour":  boolean indicating if the frame buffer
                       configuration's X visual is of type DirectColor */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
         case 35 :  /* "borderless":  windows should not have borders */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #endif
             break ;
 
index 493bcd8..1734a42 100755 (executable)
@@ -35,7 +35,7 @@
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
@@ -53,7 +53,7 @@ typedef struct {
    struct termios termio, termio_save;
 } SERIALPORT;
 
-#elif TARGET_HOST_WIN32
+#elif TARGET_HOST_MS_WINDOWS
 #include <sys/types.h>
 #include <winbase.h>
 typedef struct {
@@ -140,7 +140,7 @@ void fgInitialiseInputDevices ( void )
     if( !fgState.InputDevsInitialised )
     {
         dial_device = getenv ( "GLUT_DIALS_SERIAL" );
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS
         if (!dial_device){
             static char devname[256];
             DWORD size=sizeof(devname);
@@ -250,7 +250,7 @@ static void poll_dials ( int id )
 
 
 /******** 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 )
 {
     int fd;
@@ -313,7 +313,7 @@ static void serial_flush ( SERIALPORT *port )
     tcflush ( port->fd, TCIOFLUSH );
 }
 
-#elif TARGET_HOST_WIN32
+#elif TARGET_HOST_MS_WINDOWS
 
 static SERIALPORT *serial_open(const char *device){
     HANDLE fh;
index 8ce6f7f..572600e 100644 (file)
 #define  VERSION_MINOR 4
 #define  VERSION_PATCH 0
 
-/* Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */
-#if defined(_WIN32_WCE)
-#   define  TARGET_HOST_UNIX_X11    0
-#   define  TARGET_HOST_WIN32       0
-#   define  TARGET_HOST_WINCE       1
-#elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
-#   define  TARGET_HOST_UNIX_X11    0
-#   define  TARGET_HOST_WIN32       1
-#   define  TARGET_HOST_WINCE       0
-#else
-#   define  TARGET_HOST_UNIX_X11    1
-#   define  TARGET_HOST_WIN32       0
-#   define  TARGET_HOST_WINCE       0
-#endif
-
-#define  FREEGLUT_MAX_MENUS         3
+/* Freeglut is intended to function under all Unix/X11 and Win32 platforms. */
+/* XXX: Don't all MS-Windows compilers (except Cygwin) have _WIN32 defined?
+ * XXX: If so, remove the first set of defined()'s below.
+ */
+#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__) \
+    || defined(_WIN32) || defined(_WIN32_WCE) \
+    || ( defined(__CYGWIN__) && defined(X_DISPLAY_MISSING) )
+#   define  TARGET_HOST_MS_WINDOWS 1
 
-/* Somehow all Win32 include headers depend on this one: */
-#if TARGET_HOST_WIN32
-#include <windows.h>
-#include <windowsx.h>
-#include <mmsystem.h>
-#include <TCHAR.H>
+#elif defined(__posix__) || defined(__unix__) || defined(__linux__)
+#   define  TARGET_HOST_POSIX_X11  1
 
-/* TODO: MinGW is lacking a prototype, this should better be handled via autoconf! */
-#ifndef ChangeDisplaySettingsEx
-LONG WINAPI ChangeDisplaySettingsExA(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID);
-LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
-#ifdef UNICODE
-#define ChangeDisplaySettingsEx ChangeDisplaySettingsExW
+/* FIXME: no Macintosh support?
+#if ...
+#   define  TARGET_HOST_MAC_OSX    1
 #else
-#define ChangeDisplaySettingsEx ChangeDisplaySettingsExA
+#   error "Unrecognized target host!"
+*/
 #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
 
-#if defined(_MSC_VER) || defined(__WATCOMC__)
-#define strdup   _strdup
+#ifndef  TARGET_HOST_MAC_OSX
+#   define  TARGET_HOST_MAC_OSX    0
+#endif
+
+/* -- FIXED CONFIGURATION LIMITS ------------------------------------------- */
+
+#define  FREEGLUT_MAX_MENUS         3
+
+/* -- PLATFORM-SPECIFIC INCLUDES ------------------------------------------- */
+
+/* All Win32 headers depend on the huge Windows.h recursive include.
+ * Note: Let's use proper case for MS-Win headers. Even though it's
+ * not required due to case insensitivity, it's a good habit to keep
+ * because the cross-platform includes are case sensitive.
+ */
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
+#    include <Windows.h>
+#    include <WindowsX.h>
+#    include <MMSystem.h>
+/* CYGWIN does not have tchar.h, but has TEXT(x), defined in winnt.h. */
+#    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
+
 #endif
 
 /* 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
 #    include <sys/time.h>
 #    include <time.h>
+#elif HAVE_SYS_TIME_H
+#    include <sys/time.h>
 #else
-#    if HAVE_SYS_TIME_H
-#        include <sys/time.h>
-#    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
 
-/* The system-dependant include files should go here: */
-#if TARGET_HOST_UNIX_X11
-    #include <GL/glx.h>
-    #include <X11/Xlib.h>
-    #include <X11/Xatom.h>
-    #include <X11/keysym.h>
+#if TARGET_HOST_MS_WINDOWS
+#    define  HAVE_VPRINTF 1
+#endif
+
+#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
 
-    #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
-    #include <X11/extensions/xf86vmode.h>
-    #endif
+#if defined(_MSC_VER) || defined(__WATCOMC__)
+/* strdup() is non-standard, for all but POSIX-2001 */
+#define strdup   _strdup
 #endif
 
-/* Microsoft VisualC++ 5.0's <math.h> does not define the PI */
+/* M_PI is non-standard (defined by BSD, not ISO-C) */
 #ifndef M_PI
 #    define  M_PI  3.14159265358979323846
 #endif
@@ -198,7 +250,7 @@ struct tagSFG_XYUse
 typedef struct tagSFG_Time SFG_Time;
 struct tagSFG_Time
 {
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
     DWORD Value;
 #else
     struct timeval  Value;
@@ -268,7 +320,7 @@ struct tagSFG_State
 typedef struct tagSFG_Display SFG_Display;
 struct tagSFG_Display
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     Display*        Display;            /* The display we are being run in.  */
     int             Screen;             /* The screen we are about to use.   */
     Window          RootWindow;         /* The screen's root window.         */
@@ -290,7 +342,7 @@ struct tagSFG_Display
 
 #endif /* X_XF86VidModeGetModeLine */
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
     HINSTANCE        Instance;          /* The application's instance        */
     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
  * much conditionally-compiled code later in the library.
  */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
 typedef Window     SFG_WindowHandleType ;
 typedef GLXContext SFG_WindowContextType ;
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
 typedef HWND    SFG_WindowHandleType ;
 typedef HGLRC   SFG_WindowContextType ;
@@ -339,9 +391,9 @@ struct tagSFG_Context
     SFG_WindowHandleType  Handle;    /* The window's handle                 */
     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     */
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
     HDC             Device;          /* The window's device context         */
 #endif
 
@@ -440,7 +492,7 @@ do                                                             \
  * current window.
  *
  */
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) /* FIXME: also WinCE? */
 #define INVOKE_WCB(window,cbname,arg_list)    \
 do                                            \
 {                                             \
@@ -517,7 +569,7 @@ enum
 typedef struct tagSFG_MenuContext SFG_MenuContext;
 struct tagSFG_MenuContext
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     XVisualInfo*        MVisualInfo;      /* The window's visual information */
 #endif
 
@@ -746,12 +798,12 @@ void fgCreateStructure( void );
 void fgDestroyStructure( void );
 
 /* 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 );
 #endif
 
 /* 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,
                                WPARAM wParam, LPARAM lParam );
 GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
index eba92a2..f19c5b2 100644 (file)
@@ -59,7 +59,7 @@
 #    include <IOKit/hid/IOHIDLib.h>
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
 #    define _JS_MAX_AXES  8
 #    include <windows.h>
 #    include <mmsystem.h>
@@ -67,7 +67,7 @@
 
 #endif
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #    define _JS_MAX_AXES 16
 #    if HAVE_SYS_IOCTL_H
 #        include <sys/ioctl.h>
@@ -385,14 +385,14 @@ struct tagSFG_Joystick
          maxReport[_JS_MAX_AXES];
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
     JOYCAPS     jsCaps;
     JOYINFOEX   js;
     UINT        js_id;
 #endif
 
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #   if defined(__FreeBSD__) || defined(__NetBSD__)
        struct os_specific_s *os;
 #   endif
@@ -455,7 +455,7 @@ static SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
  */
 static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
 {
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
     MMRESULT status;
 #else
     int status;
@@ -531,7 +531,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
     }
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
     status = joyGetPosEx( joy->js_id, &joy->js );
 
     if ( status != JOYERR_NOERROR )
@@ -597,7 +597,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
     }
 #endif
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #    if defined(__FreeBSD__) || defined(__NetBSD__)
     if ( joy->os->is_analog )
     {
@@ -975,7 +975,7 @@ static void fghJoystickAddHatElement ( SFG_Joystick *joy, CFDictionaryRef button
 }
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
 /* Inspired by
    http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp
  */
@@ -1053,7 +1053,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
         CFDictionaryRef props;
     CFTypeRef topLevelElement;
 #endif
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #    if defined( __FreeBSD__ ) || defined( __NetBSD__ )
        char *cp;
 #    endif
@@ -1227,7 +1227,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
     CFRelease( props );
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
     joy->js.dwFlags = JOY_RETURNALL;
     joy->js.dwSize  = sizeof( joy->js );
 
@@ -1289,7 +1289,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
     }
 #endif
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #if defined( __FreeBSD__ ) || defined( __NetBSD__ )
     for( i = 0; i < _JS_MAX_AXES; i++ )
         joy->os->cache_axes[ i ] = 0.0f;
@@ -1535,7 +1535,7 @@ static void fghJoystickInit( int ident )
     }
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
     switch( ident )
     {
     case 0:
@@ -1553,7 +1553,7 @@ static void fghJoystickInit( int ident )
     }
 #endif
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #    if defined( __FreeBSD__ ) || defined( __NetBSD__ )
     fgJoystick[ ident ]->id = ident;
     fgJoystick[ ident ]->error = GL_FALSE;
@@ -1618,11 +1618,11 @@ void fgJoystickClose( void )
                 close( fgJoystick[ ident ]->hidDev );
 #endif
 
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
             /* Do nothing special */
 #endif
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 #if defined( __FreeBSD__ ) || defined( __NetBSD__ )
             if( fgJoystick[ident]->os )
             {
index 302a16e..c78dab8 100644 (file)
 #include "freeglut_internal.h"
 #include <errno.h>
 #include <stdarg.h>
-#if TARGET_HOST_WIN32
+#if  HAVE_VPRINTF
 #    define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
+#elif HAVE_DOPRNT
+#    define VFPRINTF(s,f,a) _doprnt((f),(a),(s))
 #else
-#    if HAVE_VPRINTF
-#        define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
-#    elif HAVE_DOPRNT
-#        define VFPRINTF(s,f,a) _doprnt((f),(a),(s))
-#    else
-#        define VFPRINTF(s,f,a)
-#    endif
+#    define VFPRINTF(s,f,a)
 #endif
 
-#if TARGET_HOST_WINCE
+#ifdef _WIN32_WCE
 
 typedef struct GXDisplayProperties GXDisplayProperties;
 typedef struct GXKeyList GXKeyList;
@@ -55,7 +51,7 @@ GXOPENINPUT GXOpenInput_ = NULL;
 
 struct GXKeyList gxKeyList;
 
-#endif
+#endif /* _WIN32_WCE */
 
 /*
  * 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 );
 
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XResizeWindow( fgDisplay.Display, window->Window.Handle,
                    width, height );
     XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
 
-#elif TARGET_HOST_WIN32
+#elif TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
     {
         RECT winRect;
         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 to keep in lockstep with UNIX_X11 code.
+     * XXX to keep in lockstep with POSIX_X11 code.
      */
     if( FETCH_WCB( *window, Reshape ) )
         INVOKE_WCB( *window, Reshape, ( width, height ) );
@@ -225,9 +221,9 @@ static void fghcbDisplayWindow( SFG_Window *window,
     {
         window->State.Redisplay = GL_FALSE;
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
         fghRedrawWindow ( window ) ;
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
         RedrawWindow(
             window->Window.Handle, NULL, NULL,
             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 <=
         checkTime )
     {
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
         fgJoystickPollWindow( window );
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
         window->State.JoystickLastPoll = checkTime;
     }
 
@@ -312,7 +308,7 @@ long fgElapsedTime( void )
 {
     if ( fgState.Time.Set )
     {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
         struct timeval now;
         long elapsed;
 
@@ -322,20 +318,24 @@ long fgElapsedTime( void )
         elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000;
 
         return elapsed;
-#elif TARGET_HOST_WIN32
-        return timeGetTime() - fgState.Time.Value;
-#elif TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
+#    if defined(_WIN32_WCE)
         return GetTickCount() - fgState.Time.Value;
+#    else
+        return timeGetTime() - fgState.Time.Value;
+#    endif
 #endif
     }
     else
     {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
         gettimeofday( &fgState.Time.Value, NULL );
-#elif TARGET_HOST_WIN32
-        fgState.Time.Value = timeGetTime ();
-#elif TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
+#    if defined(_WIN32_WCE)
         fgState.Time.Value = GetTickCount();
+#    else
+        fgState.Time.Value = timeGetTime ();
+#    endif
 #endif
         fgState.Time.Set = GL_TRUE ;
 
@@ -461,7 +461,7 @@ static void fghSleepForEvents( void )
     if( fghHaveJoystick( ) && ( msec > 10 ) )     
         msec = 10;
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     /*
      * Possibly due to aggressive use of XFlush() and friends,
      * it is possible to have our socket drained but still have
@@ -488,12 +488,12 @@ static void fghSleepForEvents( void )
         if( ( -1 == err ) && ( errno != EINTR ) )
             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 );
 #endif
 }
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 /*
  * Returns GLUT modifier mask for the state field of an X11 event.
  */
@@ -513,7 +513,7 @@ static int fghGetXModifiers( int state )
 #endif
 
 
-#if TARGET_HOST_UNIX_X11 && _DEBUG
+#if TARGET_HOST_POSIX_X11 && _DEBUG
 
 static const char* fghTypeToString( int type )
 {
@@ -964,7 +964,7 @@ static void fghPrintEvent( XEvent *event )
  */
 void FGAPIENTRY glutMainLoopEvent( void )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     SFG_Window* window;
     XEvent event;
 
@@ -1409,7 +1409,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
         }
     }
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     MSG stMsg;
 
@@ -1451,13 +1451,13 @@ void FGAPIENTRY glutMainLoop( void )
 {
     int action;
 
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
     SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
 #endif
 
     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
      * 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.
  */
@@ -1584,7 +1584,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
         {
             unsigned int current_DisplayMode = fgState.DisplayMode;
             fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH;
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
             fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
 #endif
             fgState.DisplayMode = current_DisplayMode;
@@ -1606,7 +1606,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
         }
         else
         {
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
             fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
 #endif
 
@@ -1628,7 +1628,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
 
         ReleaseDC( window->Window.Handle, window->Window.Device );
 
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         /* Take over button handling */
         {
             HINSTANCE dxDllLib=LoadLibrary(_T("gx.dll"));
@@ -1644,7 +1644,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                 gxKeyList = (*GXGetDefaultKeys_)(GX_LANDSCAPEKEYS);
         }
 
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
         break;
 
     case WM_SIZE:
@@ -1656,13 +1656,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
         if( window->State.Visible )
         {
             window->State.NeedToResize = GL_TRUE;
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
             window->State.Width  = HIWORD(lParam);
             window->State.Height = LOWORD(lParam);
 #else
             window->State.Width  = LOWORD(lParam);
             window->State.Height = HIWORD(lParam);
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
         }
 
         break;
@@ -1733,13 +1733,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
 
     case WM_MOUSEMOVE:
     {
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         window->State.MouseX = 320-HIWORD( lParam );
         window->State.MouseY = LOWORD( lParam );
 #else
         window->State.MouseX = LOWORD( lParam );
         window->State.MouseY = HIWORD( lParam );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
         /* Restrict to [-32768, 32767] to match X11 behaviour       */
         /* See comment in "freeglut_developer" mailing list 10/4/04 */
         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;
         int button;
 
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         window->State.MouseX = 320-HIWORD( lParam );
         window->State.MouseY = LOWORD( lParam );
 #else
         window->State.MouseX = LOWORD( lParam );
         window->State.MouseY = HIWORD( lParam );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
         /* Restrict to [-32768, 32767] to match X11 behaviour       */
         /* See comment in "freeglut_developer" mailing list 10/4/04 */
@@ -1821,7 +1821,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             break;
         }
 
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
         if( GetSystemMetrics( SM_SWAPBUTTON ) )
         {
             if( button == GLUT_LEFT_BUTTON )
@@ -1830,7 +1830,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                 if( button == GLUT_RIGHT_BUTTON )
                     button = GLUT_LEFT_BUTTON;
         }
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
 
         if( button == -1 )
             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(wParam==(unsigned)gxKeyList.vkRight)
@@ -2086,7 +2086,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
 
         default:
         {
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
             BYTE state[ 256 ];
             WORD code[ 2 ];
 
@@ -2099,7 +2099,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                         ( (char)wParam,
                           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 );
         break;
 
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
     case WM_SYNCPAINT:  /* 0x0088 */
         /* Another window has moved, need to update this one */
         window->State.Redisplay = GL_TRUE;
@@ -2247,7 +2247,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                 break;
             }
         }
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
 
         /* We need to pass the message on to the operating system as well */
         lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
index e684591..ec2ff45 100644 (file)
@@ -52,7 +52,7 @@
  * that that wasn't the original intent...if not, perhaps we need another
  * 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
 #else
 #define  FREEGLUT_MENU_FONT    GLUT_BITMAP_HELVETICA_18
@@ -71,7 +71,7 @@
  * too.  These variables should be stuffed into global state and initialized
  * 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_back  [4] = {0.85f, 0.85f, 0.85f, 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 TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
         int wx, wy;
         Window w;
 
index 0f8a7bb..b2b3a2c 100644 (file)
@@ -133,11 +133,11 @@ void FGAPIENTRY glutSetKeyRepeat( int repeatMode )
 void FGAPIENTRY glutForceJoystickFunc( void )
 {
     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( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) );
     fgJoystickPollWindow( fgStructure.CurrentWindow );
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
 }
 
 /*
index efc94b1..4da1b5e 100644 (file)
@@ -45,7 +45,7 @@
 
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 /*
  * Queries the GL context about some attributes
  */
@@ -124,7 +124,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
  */
 int FGAPIENTRY glutGet( GLenum eWhat )
 {
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
     int returnValue ;
     GLboolean boolValue ;
 #endif
@@ -162,7 +162,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
         /* XXX Multisampling. Return what I know about multisampling. */
         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
      * check them
@@ -277,7 +277,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
 
         return fgStructure.CurrentWindow->Window.VisualInfo->visualid;
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     /* Handle the OpenGL inquiries */
     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... */
 
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
         if ( ( fgStructure.GameModeWindow != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) &&
              ( ! fgStructure.CurrentWindow->IsMenu ) )
         {
@@ -378,7 +378,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
           winRect.top    += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
           winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
         }
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
 
         switch( eWhat )
         {
@@ -391,33 +391,33 @@ int FGAPIENTRY glutGet( GLenum eWhat )
     break;
 
     case GLUT_WINDOW_BORDER_WIDTH :
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         return 0;
 #else
         return GetSystemMetrics( SM_CXSIZEFRAME );
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
 
     case GLUT_WINDOW_HEADER_HEIGHT :
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         return 0;
 #else
         return GetSystemMetrics( SM_CYCAPTION );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
     case GLUT_DISPLAY_MODE_POSSIBLE:
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         return GL_FALSE;
 #else
         return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
                                     PFD_MAIN_PLANE );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
 
     case GLUT_WINDOW_FORMAT_ID:
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
         if( fgStructure.CurrentWindow != NULL )
             return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
         return 0;
 
 #endif
@@ -486,7 +486,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
          */
         return TRUE ;
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     case GLUT_HAS_MOUSE:
         return TRUE ;
@@ -513,7 +513,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
          */
         return 3 ;
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     case GLUT_HAS_MOUSE:
         /*
@@ -524,11 +524,11 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
 
     case GLUT_NUM_MOUSE_BUTTONS:
         /* We are much more fortunate under Win32 about this... */
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
         return 1;
 #else
         return GetSystemMetrics( SM_CMOUSEBUTTONS );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
 #endif
 
@@ -612,7 +612,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
     switch( eWhat )
     {
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     case GLUT_OVERLAY_POSSIBLE:
         return FALSE;
@@ -638,7 +638,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
     case GLUT_OVERLAY_DAMAGED:
         return -1;
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     case GLUT_OVERLAY_POSSIBLE:
 /*      return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
index 2faa851..722bca6 100644 (file)
@@ -81,7 +81,7 @@
 
 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;
 #else
     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 );
     glTranslated( 0.0, 0.0, -1.5 );
 
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
     glRotated( 90.0, 1.0, 0.0, 0.0 );
     glBegin( GL_TRIANGLE_STRIP );
 
@@ -163,7 +163,7 @@ static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
         glEvalMesh2(type, 0, grid, 0, grid);
       }
     }
-#endif  /* TARGET_HOST_WINCE */
+#endif  /* defined(_WIN32_WCE) */
 
     glPopMatrix();
     glPopAttrib();
index 1af56b7..3bf83e1 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef  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)
  */
@@ -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
 };
 
-#else  /* TARGET_HOST_WINCE */
+#else  /* defined(_WIN32_WCE) */
 
 /*
  * 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, 1.0}, {1.0, 1.0} }
 };
-#endif  /* TARGET_HOST_WINCE */
+#endif  /* defined(_WIN32_WCE) */
 
 
 #endif  /* FREEGLUT_TEAPOT_DATA_H */
index 4a702ad..9939e50 100644 (file)
@@ -28,7 +28,7 @@
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
 #include <aygshell.h>
 #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:
@@ -73,7 +73,7 @@ static wchar_t* fghWstrFromStr(const char* str)
 /*
  * Chooses a visual basing on the current display mode settings
  */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
 XVisualInfo* fgChooseVisual( void )
 {
@@ -169,11 +169,11 @@ XVisualInfo* fgChooseVisual( void )
 /*
  * Setup the pixel format for a Win32 window
  */
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS
 GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
                               unsigned char layer_type )
 {
-#if TARGET_HOST_WINCE
+#ifdef _WIN32_WCE
     return GL_TRUE;
 #else
     PIXELFORMATDESCRIPTOR* ppfd, pfd;
@@ -244,9 +244,9 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
     if( checkOnly )
         return GL_TRUE;
     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
@@ -254,14 +254,14 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
  */
 void fgSetWindow ( SFG_Window *window )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     if ( window )
         glXMakeCurrent(
             fgDisplay.Display,
             window->Window.Handle,
             window->Window.Context
         );
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
     if( fgStructure.CurrentWindow )
         ReleaseDC( fgStructure.CurrentWindow->Window.Handle,
                    fgStructure.CurrentWindow->Window.Device );
@@ -287,7 +287,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
                    int x, int y, int w, int h,
                    GLboolean gameMode, GLboolean isSubWindow )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
     XSetWindowAttributes winAttr;
     XTextProperty textProperty;
     XSizeHints sizeHints;
@@ -478,7 +478,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
 
     XMapWindow( fgDisplay.Display, window->Window.Handle );
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     WNDCLASS wc;
     DWORD flags;
@@ -504,7 +504,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
     }
     else
     {
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
         if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
         {
             /*
@@ -516,7 +516,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
             h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 +
                 GetSystemMetrics( SM_CYCAPTION );
         }
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
         if( ! fgState.Position.Use )
         {
@@ -540,7 +540,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
             flags |= WS_POPUP;
             exFlags |= WS_EX_TOOLWINDOW;
         }
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
         else if( window->Parent == NULL )
             flags |= WS_OVERLAPPEDWINDOW;
 #endif
@@ -548,7 +548,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
             flags |= WS_CHILD;
     }
 
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
     {
         wchar_t* wstr = fghWstrFromStr(title);
 
@@ -584,17 +584,17 @@ void fgOpenWindow( SFG_Window* window, const char* title,
         fgDisplay.Instance,
         (LPVOID) window
     );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
     if( !( window->Window.Handle ) )
         fgError( "Failed to create a window (%s)!", title );
 
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
     ShowWindow( window->Window.Handle, SW_SHOW );
 #else
     ShowWindow( window->Window.Handle,
                 fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW );
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
 
     UpdateWindow( window->Window.Handle );
     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 )
 {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     glXDestroyContext( fgDisplay.Display, window->Window.Context );
     XFree( window->Window.VisualInfo );
     XDestroyWindow( fgDisplay.Display, window->Window.Handle );
     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 */
     if( fgStructure.CurrentWindow == window )
@@ -779,12 +779,12 @@ void FGAPIENTRY glutShowWindow( void )
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutShowWindow" );
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutShowWindow" );
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XMapWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
     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 );
 
@@ -801,7 +801,7 @@ void FGAPIENTRY glutHideWindow( void )
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutHideWindow" );
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutHideWindow" );
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     if( fgStructure.CurrentWindow->Parent == NULL )
         XWithdrawWindow( fgDisplay.Display,
@@ -812,7 +812,7 @@ void FGAPIENTRY glutHideWindow( void )
                       fgStructure.CurrentWindow->Window.Handle );
     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 );
 
@@ -830,13 +830,13 @@ void FGAPIENTRY glutIconifyWindow( void )
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutIconifyWindow" );
 
     fgStructure.CurrentWindow->State.Visible   = GL_FALSE;
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
                     fgDisplay.Screen );
     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 );
 
@@ -854,7 +854,7 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetWindowTitle" );
     if( ! fgStructure.CurrentWindow->Parent )
     {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
         XTextProperty text;
 
@@ -871,18 +871,17 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
 
         XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
 
-#elif TARGET_HOST_WIN32
-
-        SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
-
-#elif TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
+#    ifdef _WIN32_WCE
         {
             wchar_t* wstr = fghWstrFromStr(title);
-
             SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
-
             free(wstr);
         }
+#    else
+        SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
+#    endif
+
 #endif
     }
 }
@@ -897,7 +896,7 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
 
     if( ! fgStructure.CurrentWindow->Parent )
     {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
         XTextProperty text;
 
@@ -914,18 +913,17 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
 
         XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
 
-#elif TARGET_HOST_WIN32
-
-        SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
-
-#elif TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
+#    ifdef _WIN32_WCE
         {
             wchar_t* wstr = fghWstrFromStr(title);
-
             SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
-
             free(wstr);
         }
+#    else
+        SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
+#    endif
+
 #endif
     }
 }
@@ -951,13 +949,13 @@ void FGAPIENTRY glutPositionWindow( int x, int y )
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPositionWindow" );
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPositionWindow" );
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
                  x, y );
     XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     {
         RECT winRect;
@@ -985,11 +983,11 @@ void FGAPIENTRY glutPushWindow( void )
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPushWindow" );
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPushWindow" );
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XLowerWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     SetWindowPos(
         fgStructure.CurrentWindow->Window.Handle,
@@ -1009,11 +1007,11 @@ void FGAPIENTRY glutPopWindow( void )
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPopWindow" );
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPopWindow" );
 
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
 
     XRaiseWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
 
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
 
     SetWindowPos(
         fgStructure.CurrentWindow->Window.Handle,
@@ -1034,7 +1032,7 @@ void FGAPIENTRY glutFullScreen( void )
     FREEGLUT_EXIT_IF_NO_WINDOW ( "glutFullScreen" );
 
     {
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
         int x, y;
         Window w;
 
@@ -1064,7 +1062,7 @@ void FGAPIENTRY glutFullScreen( void )
             );
             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;
 
         /* For fullscreen mode, force the top-left corner to 0,0