(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
#include <GL/freeglut.h>
#include "freeglut_internal.h"
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
#include <X11/cursorfont.h>
#endif
/* -- PRIVATE FUNCTIONS --------------------------------------------------- */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
/*
* A factory method for an empty cursor
*/
*/
void fgSetCursor ( SFG_Window *window, int cursorID )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
{
Cursor cursor;
/*
}
}
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
/*
* This is a temporary solution only...
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,
/* Make the warp visible immediately. */
XFlush( fgDisplay.Display );
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
{
POINT coords;
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
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);
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);
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;
*/
static void fghRememberState( void )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
/*
* This highly depends on the XFree86 extensions,
*/
# endif
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
/* DEVMODE devMode; */
*/
static void fghRestoreState( void )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
# ifdef X_XF86VidModeGetAllModeLines
/* Restore the remembered pointer position: */
*/
# endif
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
/* Restore the previously rememebered desktop display settings */
ChangeDisplaySettings( &fgDisplay.DisplayMode, 0 );
#endif
}
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
#ifdef X_XF86VidModeGetAllModeLines
/*
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,
# endif
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
DEVMODE devMode;
char *fggmstr = NULL;
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
fgAddToWindowDestroyList( fgStructure.GameModeWindow );
fgStructure.GameModeWindow = NULL;
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
XUngrabPointer( fgDisplay.Display, CurrentTime );
XUngrabKeyboard( fgDisplay.Display, CurrentTime );
#include "freeglut_internal.h"
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
struct freeglutStrokeFont
{
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 },
*/
static void fghInitialize( const char* displayName )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
fgDisplay.Display = XOpenDisplay( displayName );
if( fgDisplay.Display == NULL )
FALSE
);
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
WNDCLASS wc;
ATOM atom;
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 );
/* 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
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;
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
*/
XCloseDisplay( fgDisplay.Display );
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
/* Reset the timer granularity */
timeEndPeriod ( 1 );
* Everything inside the following #ifndef is copied from the X sources.
*/
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
/*
fgElapsedTime( );
/* check if GLUT_FPS env var is set */
-#if !TARGET_HOST_WINCE
+#ifndef _WIN32_WCE
{
const char *fps = getenv( "GLUT_FPS" );
if( fps )
argv[ i ] = argv[ j ];
}
-#endif /* TARGET_HOST_WINCE */
+#endif /* _WIN32_WCE */
/*
* Have the display created now. If there wasn't a "-display"
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 ;
#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>
struct termios termio, termio_save;
} SERIALPORT;
-#elif TARGET_HOST_WIN32
+#elif TARGET_HOST_MS_WINDOWS
#include <sys/types.h>
#include <winbase.h>
typedef struct {
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);
/******** 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;
tcflush ( port->fd, TCIOFLUSH );
}
-#elif TARGET_HOST_WIN32
+#elif TARGET_HOST_MS_WINDOWS
static SERIALPORT *serial_open(const char *device){
HANDLE fh;
#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. */
#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
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;
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. */
#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 */
* 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 ;
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
* 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 \
{ \
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
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,
# 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>
#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>
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
*/
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;
}
#endif
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
status = joyGetPosEx( joy->js_id, &joy->js );
if ( status != JOYERR_NOERROR )
}
#endif
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
# if defined(__FreeBSD__) || defined(__NetBSD__)
if ( joy->os->is_analog )
{
}
#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
*/
CFDictionaryRef props;
CFTypeRef topLevelElement;
#endif
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
# if defined( __FreeBSD__ ) || defined( __NetBSD__ )
char *cp;
# endif
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 );
}
#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;
}
#endif
-#if TARGET_HOST_WIN32
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)
switch( ident )
{
case 0:
}
#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;
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 )
{
#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;
struct GXKeyList gxKeyList;
-#endif
+#endif /* _WIN32_WCE */
/*
* Try to get the maximum value allowed for ints, falling back to the minimum
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;
/*
* 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 ) );
{
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
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;
}
{
if ( fgState.Time.Set )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
struct timeval now;
long elapsed;
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 ;
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
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.
*/
#endif
-#if TARGET_HOST_UNIX_X11 && _DEBUG
+#if TARGET_HOST_POSIX_X11 && _DEBUG
static const char* fghTypeToString( int type )
{
*/
void FGAPIENTRY glutMainLoopEvent( void )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
SFG_Window* window;
XEvent event;
}
}
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
MSG stMsg;
{
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,
}
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
/*
* Determine a GLUT modifer mask based on MS-WINDOWS system info.
*/
{
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;
}
else
{
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
#endif
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"));
gxKeyList = (*GXGetDefaultKeys_)(GX_LANDSCAPEKEYS);
}
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
break;
case WM_SIZE:
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;
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;
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 */
break;
}
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
if( GetSystemMetrics( SM_SWAPBUTTON ) )
{
if( button == GLUT_LEFT_BUTTON )
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 );
);
}
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
if(!(lParam & 0x40000000)) /* Prevent auto-repeat */
{
if(wParam==(unsigned)gxKeyList.vkRight)
default:
{
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
BYTE state[ 256 ];
WORD code[ 2 ];
( (char)wParam,
window->State.MouseX, window->State.MouseY )
);
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
}
}
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;
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 );
* 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
* 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};
{
if( fgStructure.GameModeWindow )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
int wx, wy;
Window w;
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) */
}
/*
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
/*
* Queries the GL context about some attributes
*/
*/
int FGAPIENTRY glutGet( GLenum eWhat )
{
-#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#if TARGET_HOST_MS_WINDOWS
int returnValue ;
GLboolean boolValue ;
#endif
/* 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
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:
/* ...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 ) )
{
winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
}
-#endif /* !TARGET_HOST_WINCE */
+#endif /* !defined(_WIN32_WCE) */
switch( 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
*/
return TRUE ;
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
case GLUT_HAS_MOUSE:
return TRUE ;
*/
return 3 ;
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
case GLUT_HAS_MOUSE:
/*
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
switch( eWhat )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
case GLUT_OVERLAY_POSSIBLE:
return FALSE;
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,
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];
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 );
glEvalMesh2(type, 0, grid, 0, grid);
}
}
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
glPopMatrix();
glPopAttrib();
#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)
*/
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:
{ {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 */
#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 */
}
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
/*
* TODO BEFORE THE STABLE RELEASE:
/*
* Chooses a visual basing on the current display mode settings
*/
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
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;
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
*/
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 );
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;
XMapWindow( fgDisplay.Display, window->Window.Handle );
-#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+#elif TARGET_HOST_MS_WINDOWS
WNDCLASS wc;
DWORD flags;
}
else
{
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
{
/*
h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 +
GetSystemMetrics( SM_CYCAPTION );
}
-#endif /* TARGET_HOST_WINCE */
+#endif /* defined(_WIN32_WCE) */
if( ! fgState.Position.Use )
{
flags |= WS_POPUP;
exFlags |= WS_EX_TOOLWINDOW;
}
-#if !TARGET_HOST_WINCE
+#if !defined(_WIN32_WCE)
else if( window->Parent == NULL )
flags |= WS_OVERLAPPEDWINDOW;
#endif
flags |= WS_CHILD;
}
-#if TARGET_HOST_WINCE
+#if defined(_WIN32_WCE)
{
wchar_t* wstr = fghWstrFromStr(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"! */
*/
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 )
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 );
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,
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 );
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 );
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetWindowTitle" );
if( ! fgStructure.CurrentWindow->Parent )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
XTextProperty text;
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
}
}
if( ! fgStructure.CurrentWindow->Parent )
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
XTextProperty text;
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
}
}
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;
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,
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,
FREEGLUT_EXIT_IF_NO_WINDOW ( "glutFullScreen" );
{
-#if TARGET_HOST_UNIX_X11
+#if TARGET_HOST_POSIX_X11
int x, y;
Window w;
);
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