Pixmap cursorNonePixmap;\r
memset( cursorNoneBits, 0, sizeof( cursorNoneBits ) );\r
memset( &dontCare, 0, sizeof( dontCare ) );\r
- cursorNonePixmap = XCreateBitmapFromData ( fgDisplay.Display,\r
- fgDisplay.RootWindow,\r
+ cursorNonePixmap = XCreateBitmapFromData ( fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.RootWindow,\r
cursorNoneBits, 16, 16 );\r
if( cursorNonePixmap != None ) {\r
- cursorNone = XCreatePixmapCursor( fgDisplay.Display,\r
+ cursorNone = XCreatePixmapCursor( fgDisplay.pDisplay.Display,\r
cursorNonePixmap, cursorNonePixmap,\r
&dontCare, &dontCare, 0, 0 );\r
- XFreePixmap( fgDisplay.Display, cursorNonePixmap );\r
+ XFreePixmap( fgDisplay.pDisplay.Display, cursorNonePixmap );\r
}\r
}\r
return cursorNone;\r
cursorCacheEntry *entry = &cursorCache[ cursorIDToUse ];\r
if( entry->cachedCursor == None ) {\r
entry->cachedCursor =\r
- XCreateFontCursor( fgDisplay.Display, entry->cursorShape );\r
+ XCreateFontCursor( fgDisplay.pDisplay.Display, entry->cursorShape );\r
}\r
cursor = entry->cachedCursor;\r
} else {\r
}\r
\r
if ( cursorIDToUse == GLUT_CURSOR_INHERIT ) {\r
- XUndefineCursor( fgDisplay.Display, window->Window.Handle );\r
+ XUndefineCursor( fgDisplay.pDisplay.Display, window->Window.Handle );\r
} else if ( cursor != None ) {\r
- XDefineCursor( fgDisplay.Display, window->Window.Handle, cursor );\r
+ XDefineCursor( fgDisplay.pDisplay.Display, window->Window.Handle, cursor );\r
} else if ( cursorIDToUse != GLUT_CURSOR_NONE ) {\r
fgError( "Failed to create cursor" );\r
}\r
void fgPlatformWarpPointer ( int x, int y )\r
{\r
XWarpPointer(\r
- fgDisplay.Display,\r
+ fgDisplay.pDisplay.Display,\r
None,\r
fgStructure.CurrentWindow->Window.Handle,\r
0, 0, 0, 0,\r
x, y\r
);\r
/* Make the warp visible immediately. */\r
- XFlush( fgDisplay.Display );\r
+ XFlush( fgDisplay.pDisplay.Display );\r
}\r
#endif\r
\r
return;\r
\r
#if TARGET_HOST_POSIX_X11\r
- glXSwapBuffers( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle );\r
+ glXSwapBuffers( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle );\r
#elif TARGET_HOST_MS_WINDOWS\r
SwapBuffers( fgStructure.CurrentWindow->Window.Device );\r
#endif\r
Status result = -1;\r
\r
/* must check at runtime for the availability of the extension */\r
- if(!XRRQueryExtension(fgDisplay.Display, &event_base, &error_base)) {\r
+ if(!XRRQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) {\r
return -1;\r
}\r
\r
- XRRQueryVersion(fgDisplay.Display, &ver_major, &ver_minor);\r
+ XRRQueryVersion(fgDisplay.pDisplay.Display, &ver_major, &ver_minor);\r
\r
/* we only heed the rate if we CAN actually use it (Xrandr >= 1.1) and\r
* the user actually cares about it (rate > 0)\r
XRRFreeScreenConfigInfo(xrr_config);\r
}\r
\r
- if(!(xrr_config = XRRGetScreenInfo(fgDisplay.Display, fgDisplay.RootWindow))) {\r
+ if(!(xrr_config = XRRGetScreenInfo(fgDisplay.pDisplay.Display, fgDisplay.RootWindow))) {\r
fgWarning("XRRGetScreenInfo failed");\r
break;\r
}\r
\r
#if ( RANDR_MAJOR >= 1 ) || ( ( RANDR_MAJOR == 1 ) && ( RANDR_MINOR >= 1 ) )\r
if(use_rate)\r
- result = XRRSetScreenConfigAndRate(fgDisplay.Display, xrr_config,\r
- fgDisplay.RootWindow, res_idx, rot, rate, timestamp);\r
+ result = XRRSetScreenConfigAndRate(fgDisplay.pDisplay.Display, xrr_config,\r
+ fgDisplay.pDisplay.RootWindow, res_idx, rot, rate, timestamp);\r
else\r
#endif\r
- result = XRRSetScreenConfig(fgDisplay.Display, xrr_config,\r
- fgDisplay.RootWindow, res_idx, rot, timestamp);\r
+ result = XRRSetScreenConfig(fgDisplay.pDisplay.Display, xrr_config,\r
+ fgDisplay.pDisplay.RootWindow, res_idx, rot, timestamp);\r
\r
} while(result == RRSetConfigInvalidTime);\r
\r
Window junk_window;\r
unsigned int junk_mask;\r
\r
- XQueryPointer(fgDisplay.Display, fgDisplay.RootWindow,\r
+ XQueryPointer(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.RootWindow,\r
&junk_window, &junk_window,\r
- &fgDisplay.DisplayPointerX, &fgDisplay.DisplayPointerY,\r
- &fgDisplay.DisplayPointerX, &fgDisplay.DisplayPointerY, &junk_mask);\r
+ &fgDisplay.pDisplay.DisplayPointerX, &fgDisplay.pDisplay.DisplayPointerY,\r
+ &fgDisplay.pDisplay.DisplayPointerX, &fgDisplay.pDisplay.DisplayPointerY, &junk_mask);\r
\r
# ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
- if(XRRQueryExtension(fgDisplay.Display, &event_base, &error_base)) {\r
+ if(XRRQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) {\r
XRRScreenConfiguration *xrr_config;\r
XRRScreenSize *ssizes;\r
Rotation rot;\r
int ssize_count, curr;\r
\r
- if((xrr_config = XRRGetScreenInfo(fgDisplay.Display, fgDisplay.RootWindow))) {\r
+ if((xrr_config = XRRGetScreenInfo(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.RootWindow))) {\r
ssizes = XRRConfigSizes(xrr_config, &ssize_count);\r
curr = XRRConfigCurrentConfiguration(xrr_config, &rot);\r
\r
- fgDisplay.prev_xsz = ssizes[curr].width;\r
- fgDisplay.prev_ysz = ssizes[curr].height;\r
- fgDisplay.prev_refresh = -1;\r
+ fgDisplay.pDisplay.prev_xsz = ssizes[curr].width;\r
+ fgDisplay.pDisplay.prev_ysz = ssizes[curr].height;\r
+ fgDisplay.pDisplay.prev_refresh = -1;\r
\r
# if ( RANDR_MAJOR >= 1 ) || ( ( RANDR_MAJOR == 1 ) && ( RANDR_MINOR >= 1 ) )\r
if(fgState.GameModeRefresh != -1) {\r
- fgDisplay.prev_refresh = XRRConfigCurrentRate(xrr_config);\r
+ fgDisplay.pDisplay.prev_refresh = XRRConfigCurrentRate(xrr_config);\r
}\r
# endif\r
\r
- fgDisplay.prev_size_valid = 1;\r
+ fgDisplay.pDisplay.prev_size_valid = 1;\r
\r
XRRFreeScreenConfigInfo(xrr_config);\r
}\r
* not approved as X Consortium standards\r
*/\r
# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
- if(!XF86VidModeQueryExtension(fgDisplay.Display, &event_base, &error_base)) {\r
+ if(!XF86VidModeQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) {\r
return;\r
}\r
\r
* restore the ViewPort on LeaveGameMode():\r
*/\r
if( !XF86VidModeGetViewPort(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
- &fgDisplay.DisplayViewPortX,\r
- &fgDisplay.DisplayViewPortY ) )\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
+ &fgDisplay.pDisplay.DisplayViewPortX,\r
+ &fgDisplay.pDisplay.DisplayViewPortY ) )\r
fgWarning( "XF86VidModeGetViewPort failed" );\r
\r
\r
/* Query the current display settings: */\r
- fgDisplay.DisplayModeValid =\r
+ fgDisplay.pDisplay.DisplayModeValid =\r
XF86VidModeGetModeLine(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
- &fgDisplay.DisplayModeClock,\r
- &fgDisplay.DisplayMode\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
+ &fgDisplay.pDisplay.DisplayModeClock,\r
+ &fgDisplay.pDisplay.DisplayMode\r
);\r
\r
- if( !fgDisplay.DisplayModeValid )\r
+ if( !fgDisplay.pDisplay.DisplayModeValid )\r
fgWarning( "XF86VidModeGetModeLine failed" );\r
# endif\r
\r
{\r
/* Restore the remembered pointer position: */\r
XWarpPointer(\r
- fgDisplay.Display, None, fgDisplay.RootWindow, 0, 0, 0, 0,\r
- fgDisplay.DisplayPointerX, fgDisplay.DisplayPointerY\r
+ fgDisplay.pDisplay.Display, None, fgDisplay.pDisplay.RootWindow, 0, 0, 0, 0,\r
+ fgDisplay.pDisplay.DisplayPointerX, fgDisplay.pDisplay.DisplayPointerY\r
);\r
\r
\r
# ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
- if(fgDisplay.prev_size_valid) {\r
- if(xrandr_resize(fgDisplay.prev_xsz, fgDisplay.prev_ysz, fgDisplay.prev_refresh, 0) != -1) {\r
- fgDisplay.prev_size_valid = 0;\r
+ if(fgDisplay.pDisplay.prev_size_valid) {\r
+ if(xrandr_resize(fgDisplay.pDisplay.prev_xsz, fgDisplay.pDisplay.prev_ysz, fgDisplay.pDisplay.prev_refresh, 0) != -1) {\r
+ fgDisplay.pDisplay.prev_size_valid = 0;\r
# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
- fgDisplay.DisplayModeValid = 0;\r
+ fgDisplay.pDisplay.DisplayModeValid = 0;\r
# endif\r
return;\r
}\r
* not approved as X Consortium standards\r
*/\r
\r
- if( fgDisplay.DisplayModeValid )\r
+ if( fgDisplay.pDisplay.DisplayModeValid )\r
{\r
XF86VidModeModeInfo** displayModes;\r
int i, displayModesCount;\r
\r
if( !XF86VidModeGetAllModeLines(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
&displayModesCount,\r
&displayModes ) )\r
{\r
*/\r
for( i = 0; i < displayModesCount; i++ )\r
{\r
- if(displayModes[ i ]->hdisplay == fgDisplay.DisplayMode.hdisplay &&\r
- displayModes[ i ]->vdisplay == fgDisplay.DisplayMode.vdisplay &&\r
- displayModes[ i ]->dotclock == fgDisplay.DisplayModeClock )\r
+ if(displayModes[ i ]->hdisplay == fgDisplay.pDisplay.DisplayMode.hdisplay &&\r
+ displayModes[ i ]->vdisplay == fgDisplay.pDisplay.DisplayMode.vdisplay &&\r
+ displayModes[ i ]->dotclock == fgDisplay.pDisplay.DisplayModeClock )\r
{\r
if( !XF86VidModeSwitchToMode(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
displayModes[ i ] ) )\r
{\r
fgWarning( "XF86VidModeSwitchToMode failed" );\r
}\r
\r
if( !XF86VidModeSetViewPort(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
- fgDisplay.DisplayViewPortX,\r
- fgDisplay.DisplayViewPortY ) )\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
+ fgDisplay.pDisplay.DisplayViewPortX,\r
+ fgDisplay.pDisplay.DisplayViewPortY ) )\r
fgWarning( "XF86VidModeSetViewPort failed" );\r
\r
\r
* calls exit() we've to flush the X11 output queue to have the\r
* commands sent to the X server before the application exits.\r
*/\r
- XFlush( fgDisplay.Display );\r
+ XFlush( fgDisplay.pDisplay.Display );\r
\r
- fgDisplay.DisplayModeValid = 0;\r
+ fgDisplay.pDisplay.DisplayModeValid = 0;\r
# ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
- fgDisplay.prev_size_valid = 0;\r
+ fgDisplay.pDisplay.prev_size_valid = 0;\r
# endif\r
\r
break;\r
* This is also used by applications which check modes by calling\r
* glutGameModeGet(GLUT_GAME_MODE_POSSIBLE), so allow the check:\r
*/\r
- if( haveToTest || fgDisplay.DisplayModeValid )\r
+ if( haveToTest || fgDisplay.pDisplay.DisplayModeValid )\r
{\r
XF86VidModeModeInfo** displayModes;\r
int i, displayModesCount;\r
* glutEnterGameMode, then we need to query the current mode, to make\r
* unspecified settings to default to their current values.\r
*/\r
- if(!fgDisplay.DisplayModeValid) {\r
- if(!XF86VidModeGetModeLine(fgDisplay.Display, fgDisplay.Screen,\r
- &fgDisplay.DisplayModeClock, &fgDisplay.DisplayMode)) {\r
+ if(!fgDisplay.pDisplay.DisplayModeValid) {\r
+ if(!XF86VidModeGetModeLine(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Screen,\r
+ &fgDisplay.pDisplay.DisplayModeClock, &fgDisplay.pDisplay.DisplayMode)) {\r
return success;\r
}\r
}\r
\r
if (fgState.GameModeSize.X == -1)\r
{\r
- fgState.GameModeSize.X = fgDisplay.DisplayMode.hdisplay;\r
+ fgState.GameModeSize.X = fgDisplay.pDisplay.DisplayMode.hdisplay;\r
}\r
if (fgState.GameModeSize.Y == -1)\r
{\r
- fgState.GameModeSize.Y = fgDisplay.DisplayMode.vdisplay;\r
+ fgState.GameModeSize.Y = fgDisplay.pDisplay.DisplayMode.vdisplay;\r
}\r
if (fgState.GameModeDepth == -1)\r
{\r
if (fgState.GameModeRefresh == -1)\r
{\r
/* Compute the displays refresh rate, dotclock comes in kHz. */\r
- int refresh = ( fgDisplay.DisplayModeClock * 1000 ) /\r
- ( fgDisplay.DisplayMode.htotal * fgDisplay.DisplayMode.vtotal );\r
+ int refresh = ( fgDisplay.pDisplay.DisplayModeClock * 1000 ) /\r
+ ( fgDisplay.pDisplay.DisplayMode.htotal * fgDisplay.pDisplay.DisplayMode.vtotal );\r
\r
fgState.GameModeRefresh = refresh;\r
}\r
\r
/* query all possible display modes */\r
if( !XF86VidModeGetAllModeLines(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
&displayModesCount,\r
&displayModes ) )\r
{\r
\r
if( !haveToTest && success ) {\r
if( !XF86VidModeSwitchToMode(\r
- fgDisplay.Display,\r
- fgDisplay.Screen,\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen,\r
displayModes[ i ] ) )\r
fgWarning( "XF86VidModeSwitchToMode failed" );\r
}\r
* Sync needed to avoid a real race, the Xserver must have really created\r
* the window before we can grab the pointer into it:\r
*/\r
- XSync( fgDisplay.Display, False );\r
+ XSync( fgDisplay.pDisplay.Display, False );\r
/*\r
* Grab the pointer to confine it into the window after the calls to\r
* XWrapPointer() which ensure that the pointer really enters the window.\r
* the application which we have to aviod, so wait until it's viewable:\r
*/\r
while( GrabSuccess != XGrabPointer(\r
- fgDisplay.Display, fgStructure.GameModeWindow->Window.Handle,\r
+ fgDisplay.pDisplay.Display, fgStructure.GameModeWindow->Window.Handle,\r
TRUE,\r
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask\r
| PointerMotionMask,\r
* if the new window is not viewable yet, see the XGrabPointer loop above.\r
*/\r
XSetInputFocus(\r
- fgDisplay.Display,\r
+ fgDisplay.pDisplay.Display,\r
fgStructure.GameModeWindow->Window.Handle,\r
RevertToNone,\r
CurrentTime\r
\r
/* Move the Pointer to the middle of the fullscreen window */\r
XWarpPointer(\r
- fgDisplay.Display,\r
+ fgDisplay.pDisplay.Display,\r
None,\r
- fgDisplay.RootWindow,\r
+ fgDisplay.pDisplay.RootWindow,\r
0, 0, 0, 0,\r
fgState.GameModeSize.X/2, fgState.GameModeSize.Y/2\r
);\r
\r
# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
\r
- if( fgDisplay.DisplayModeValid )\r
+ if( fgDisplay.pDisplay.DisplayModeValid )\r
{\r
int x, y;\r
Window child;\r
\r
/* Change to viewport to the window topleft edge: */\r
- if( !XF86VidModeSetViewPort( fgDisplay.Display, fgDisplay.Screen, 0, 0 ) )\r
+ if( !XF86VidModeSetViewPort( fgDisplay.pDisplay.Display, fgDisplay.Screen, 0, 0 ) )\r
fgWarning( "XF86VidModeSetViewPort failed" );\r
\r
/*\r
\r
/* Get the current postion of the drawable area on screen */\r
XTranslateCoordinates(\r
- fgDisplay.Display,\r
+ fgDisplay.pDisplay.Display,\r
fgStructure.CurrentWindow->Window.Handle,\r
- fgDisplay.RootWindow,\r
+ fgDisplay.pDisplay.RootWindow,\r
0, 0, &x, &y,\r
&child\r
);\r
\r
/* Move the decorataions out of the topleft corner of the display */\r
- XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle,\r
+ XMoveWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle,\r
-x, -y);\r
}\r
\r
\r
/* Grab the keyboard, too */\r
XGrabKeyboard(\r
- fgDisplay.Display,\r
+ fgDisplay.pDisplay.Display,\r
fgStructure.GameModeWindow->Window.Handle,\r
FALSE,\r
GrabModeAsync, GrabModeAsync,\r
\r
#if TARGET_HOST_POSIX_X11\r
\r
- XUngrabPointer( fgDisplay.Display, CurrentTime );\r
- XUngrabKeyboard( fgDisplay.Display, CurrentTime );\r
+ XUngrabPointer( fgDisplay.pDisplay.Display, CurrentTime );\r
+ XUngrabKeyboard( fgDisplay.pDisplay.Display, CurrentTime );\r
\r
#endif\r
\r
/* Return the atom associated with "name". */\r
static Atom fghGetAtom(const char * name)\r
{\r
- return XInternAtom(fgDisplay.Display, name, False);\r
+ return XInternAtom(fgDisplay.pDisplay.Display, name, False);\r
}\r
\r
/*\r
unsigned long temp_bytes_after; /* Not used. */\r
\r
\r
- status = XGetWindowProperty(fgDisplay.Display,\r
+ status = XGetWindowProperty(fgDisplay.pDisplay.Display,\r
window,\r
property,\r
0,\r
* Check that the window manager has set this property on the root window.\r
* The property must be the ID of a child window.\r
*/\r
- number_of_windows = fghGetWindowProperty(fgDisplay.RootWindow,\r
+ number_of_windows = fghGetWindowProperty(fgDisplay.pDisplay.RootWindow,\r
wm_check,\r
XA_WINDOW,\r
(unsigned char **) window_ptr_1);\r
*/\r
void fgPlatformInitialize( const char* displayName )\r
{\r
- fgDisplay.Display = XOpenDisplay( displayName );\r
+ fgDisplay.pDisplay.Display = XOpenDisplay( displayName );\r
\r
- if( fgDisplay.Display == NULL )\r
+ if( fgDisplay.pDisplay.Display == NULL )\r
fgError( "failed to open display '%s'", XDisplayName( displayName ) );\r
\r
- if( !glXQueryExtension( fgDisplay.Display, NULL, NULL ) )\r
+ if( !glXQueryExtension( fgDisplay.pDisplay.Display, NULL, NULL ) )\r
fgError( "OpenGL GLX extension not supported by display '%s'",\r
XDisplayName( displayName ) );\r
\r
- fgDisplay.Screen = DefaultScreen( fgDisplay.Display );\r
- fgDisplay.RootWindow = RootWindow(\r
- fgDisplay.Display,\r
- fgDisplay.Screen\r
+ fgDisplay.pDisplay.Screen = DefaultScreen( fgDisplay.pDisplay.Display );\r
+ fgDisplay.pDisplay.RootWindow = RootWindow(\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen\r
);\r
\r
fgDisplay.ScreenWidth = DisplayWidth(\r
- fgDisplay.Display,\r
- fgDisplay.Screen\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen\r
);\r
fgDisplay.ScreenHeight = DisplayHeight(\r
- fgDisplay.Display,\r
- fgDisplay.Screen\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen\r
);\r
\r
fgDisplay.ScreenWidthMM = DisplayWidthMM(\r
- fgDisplay.Display,\r
- fgDisplay.Screen\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen\r
);\r
fgDisplay.ScreenHeightMM = DisplayHeightMM(\r
- fgDisplay.Display,\r
- fgDisplay.Screen\r
+ fgDisplay.pDisplay.Display,\r
+ fgDisplay.pDisplay.Screen\r
);\r
\r
- fgDisplay.Connection = ConnectionNumber( fgDisplay.Display );\r
+ fgDisplay.pDisplay.Connection = ConnectionNumber( fgDisplay.pDisplay.Display );\r
\r
/* Create the window deletion atom */\r
- fgDisplay.DeleteWindow = fghGetAtom("WM_DELETE_WINDOW");\r
+ fgDisplay.pDisplay.DeleteWindow = fghGetAtom("WM_DELETE_WINDOW");\r
\r
/* Create the state and full screen atoms */\r
- fgDisplay.State = None;\r
- fgDisplay.StateFullScreen = None;\r
+ fgDisplay.pDisplay.State = None;\r
+ fgDisplay.pDisplay.StateFullScreen = None;\r
\r
if (fghNetWMSupported())\r
{\r
const Atom state = fghGetAtom("_NET_WM_STATE");\r
\r
/* Check if the state hint is supported. */\r
- if (fgHintPresent(fgDisplay.RootWindow, supported, state))\r
+ if (fgHintPresent(fgDisplay.pDisplay.RootWindow, supported, state))\r
{\r
const Atom full_screen = fghGetAtom("_NET_WM_STATE_FULLSCREEN");\r
\r
- fgDisplay.State = state;\r
+ fgDisplay.pDisplay.State = state;\r
\r
/* Check if the window manager supports full screen. */\r
/** Check "_NET_WM_ALLOWED_ACTIONS" on our window instead? **/\r
- if (fgHintPresent(fgDisplay.RootWindow, supported, full_screen))\r
+ if (fgHintPresent(fgDisplay.pDisplay.RootWindow, supported, full_screen))\r
{\r
- fgDisplay.StateFullScreen = full_screen;\r
+ fgDisplay.pDisplay.StateFullScreen = full_screen;\r
}\r
}\r
}\r
* Make sure all X-client data we have created will be destroyed on\r
* display closing\r
*/\r
- XSetCloseDownMode( fgDisplay.Display, DestroyAll );\r
+ XSetCloseDownMode( fgDisplay.pDisplay.Display, DestroyAll );\r
\r
/*\r
* Close the display connection, destroying all windows we have\r
* created so far\r
*/\r
- XCloseDisplay( fgDisplay.Display );\r
+ XCloseDisplay( fgDisplay.pDisplay.Display );\r
}\r
\r
#endif\r
{\r
#if TARGET_HOST_POSIX_X11\r
/* Note that the MVisualInfo is not owned by the MenuContext! */\r
- glXDestroyContext( fgDisplay.Display, fgStructure.MenuContext->MContext );\r
+ glXDestroyContext( fgDisplay.pDisplay.Display, fgStructure.MenuContext->MContext );\r
#endif\r
free( fgStructure.MenuContext );\r
fgStructure.MenuContext = NULL;\r
\r
/* Platform-specific includes */\r
#if TARGET_HOST_POSIX_X11\r
+typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay;\r
+struct tagSFG_PlatformDisplay\r
+{\r
+ Display* Display; /* The display we are being run in. */\r
+ int Screen; /* The screen we are about to use. */\r
+ Window RootWindow; /* The screen's root window. */\r
+ int Connection; /* The display's connection number */\r
+ Atom DeleteWindow; /* The window deletion atom */\r
+ Atom State; /* The state atom */\r
+ Atom StateFullScreen; /* The full screen atom */\r
+\r
+#ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
+ int prev_xsz, prev_ysz;\r
+ int prev_refresh;\r
+ int prev_size_valid;\r
+#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */\r
+\r
+#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
+ /*\r
+ * XF86VidMode may be compilable even if it fails at runtime. Therefore,\r
+ * the validity of the VidMode has to be tracked\r
+ */\r
+ int DisplayModeValid; /* Flag that indicates runtime status*/\r
+ XF86VidModeModeLine DisplayMode; /* Current screen's display settings */\r
+ int DisplayModeClock; /* The display mode's refresh rate */\r
+ int DisplayViewPortX; /* saved X location of the viewport */\r
+ int DisplayViewPortY; /* saved Y location of the viewport */\r
+#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */\r
+\r
+ int DisplayPointerX; /* saved X location of the pointer */\r
+ int DisplayPointerY; /* saved Y location of the pointer */\r
+};\r
+\r
#endif\r
#if TARGET_HOST_MS_WINDOWS\r
#include "../mswin/freeglut_internal_mswin.h"\r
typedef struct tagSFG_Display SFG_Display;\r
struct tagSFG_Display\r
{\r
-#if TARGET_HOST_POSIX_X11\r
- Display* Display; /* The display we are being run in. */\r
- int Screen; /* The screen we are about to use. */\r
- Window RootWindow; /* The screen's root window. */\r
- int Connection; /* The display's connection number */\r
- Atom DeleteWindow; /* The window deletion atom */\r
- Atom State; /* The state atom */\r
- Atom StateFullScreen; /* The full screen atom */\r
-\r
-#ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
- int prev_xsz, prev_ysz;\r
- int prev_refresh;\r
- int prev_size_valid;\r
-#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */\r
-\r
-#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
- /*\r
- * XF86VidMode may be compilable even if it fails at runtime. Therefore,\r
- * the validity of the VidMode has to be tracked\r
- */\r
- int DisplayModeValid; /* Flag that indicates runtime status*/\r
- XF86VidModeModeLine DisplayMode; /* Current screen's display settings */\r
- int DisplayModeClock; /* The display mode's refresh rate */\r
- int DisplayViewPortX; /* saved X location of the viewport */\r
- int DisplayViewPortY; /* saved Y location of the viewport */\r
-#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */\r
-\r
- int DisplayPointerX; /* saved X location of the pointer */\r
- int DisplayPointerY; /* saved Y location of the pointer */\r
-\r
-#elif TARGET_HOST_MS_WINDOWS\r
- HINSTANCE Instance; /* The application's instance */\r
- DEVMODE DisplayMode; /* Desktop's display settings */\r
- char *DisplayName; /* Display name for multi display support*/ \r
-\r
-#endif\r
+ SFG_PlatformDisplay pDisplay;\r
\r
int ScreenWidth; /* The screen's width in pixels */\r
int ScreenHeight; /* The screen's height in pixels */\r
#if TARGET_HOST_POSIX_X11\r
void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height )\r
{\r
- XResizeWindow( fgDisplay.Display, window->Window.Handle,\r
+ XResizeWindow( fgDisplay.pDisplay.Display, window->Window.Handle,\r
width, height );\r
- XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */\r
+ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */\r
}\r
#endif\r
\r
* need to allow that we may have an empty socket but non-\r
* empty event queue.\r
*/\r
- if( ! XPending( fgDisplay.Display ) )\r
+ if( ! XPending( fgDisplay.pDisplay.Display ) )\r
{\r
fd_set fdset;\r
int err;\r
int socket;\r
struct timeval wait;\r
\r
- socket = ConnectionNumber( fgDisplay.Display );\r
+ socket = ConnectionNumber( fgDisplay.pDisplay.Display );\r
FD_ZERO( &fdset );\r
FD_SET( socket, &fdset );\r
wait.tv_sec = msec / 1000;\r
\r
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMainLoopEvent" );\r
\r
- while( XPending( fgDisplay.Display ) )\r
+ while( XPending( fgDisplay.pDisplay.Display ) )\r
{\r
- XNextEvent( fgDisplay.Display, &event );\r
+ XNextEvent( fgDisplay.pDisplay.Display, &event );\r
#if _DEBUG\r
fghPrintEvent( &event );\r
#endif\r
break;\r
}\r
/* Destroy the window when the WM_DELETE_WINDOW message arrives */\r
- if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow )\r
+ if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.pDisplay.DeleteWindow )\r
{\r
GETWINDOW( xclient );\r
\r
*/\r
\r
char keys[32];\r
- XQueryKeymap( fgDisplay.Display, keys ); /* Look at X11 keystate to detect repeat mode */\r
+ XQueryKeymap( fgDisplay.pDisplay.Display, keys ); /* Look at X11 keystate to detect repeat mode */\r
\r
if ( event.xkey.keycode<256 ) /* XQueryKeymap is limited to 256 keycodes */\r
{\r
Window w;\r
\r
XTranslateCoordinates(\r
- fgDisplay.Display,\r
+ fgDisplay.pDisplay.Display,\r
window->Window.Handle,\r
- fgDisplay.RootWindow,\r
+ fgDisplay.pDisplay.RootWindow,\r
0, 0, &wx, &wy, &w);\r
\r
*x = fgState.GameModeSize.X + wx;\r
/* hack to get around my stupid cross-gcc headers */\r
#define FREEGLUT_ENUM_CURRENT_SETTINGS -1\r
\r
- EnumDisplaySettings( fgDisplay.DisplayName, FREEGLUT_ENUM_CURRENT_SETTINGS,\r
- &fgDisplay.DisplayMode );\r
+ EnumDisplaySettings( fgDisplay.pDisplay.DisplayName, FREEGLUT_ENUM_CURRENT_SETTINGS,\r
+ &fgDisplay.pDisplay.DisplayMode );\r
\r
/* Make sure we will be restoring all settings needed */\r
- fgDisplay.DisplayMode.dmFields |=\r
+ fgDisplay.pDisplay.DisplayMode.dmFields |=\r
DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;\r
\r
}\r
void fgPlatformRestoreState( void )\r
{\r
/* Restore the previously remembered desktop display settings */\r
- ChangeDisplaySettingsEx( fgDisplay.DisplayName,&fgDisplay.DisplayMode, 0,0,0 );\r
+ ChangeDisplaySettingsEx( fgDisplay.pDisplay.DisplayName,&fgDisplay.pDisplay.DisplayMode, 0,0,0 );\r
\r
}\r
\r
\r
success = GL_FALSE;\r
\r
- EnumDisplaySettings( fgDisplay.DisplayName, -1, &devMode ); \r
+ EnumDisplaySettings( fgDisplay.pDisplay.DisplayName, -1, &devMode ); \r
devMode.dmFields = 0;\r
\r
if (fgState.GameModeSize.X!=-1)\r
devMode.dmFields |= DM_DISPLAYFREQUENCY;\r
}\r
\r
- switch ( ChangeDisplaySettingsEx(fgDisplay.DisplayName, &devMode, NULL, haveToTest ? CDS_TEST : CDS_FULLSCREEN , NULL) )\r
+ switch ( ChangeDisplaySettingsEx(fgDisplay.pDisplay.DisplayName, &devMode, NULL, haveToTest ? CDS_TEST : CDS_FULLSCREEN , NULL) )\r
{\r
case DISP_CHANGE_SUCCESSFUL:\r
success = GL_TRUE;\r
if (!haveToTest)\r
{\r
/* update vars in case if windows switched to proper mode */\r
- EnumDisplaySettings( fgDisplay.DisplayName, FREEGLUT_ENUM_CURRENT_SETTINGS, &devMode );\r
+ EnumDisplaySettings( fgDisplay.pDisplay.DisplayName, FREEGLUT_ENUM_CURRENT_SETTINGS, &devMode );\r
fgState.GameModeSize.X = devMode.dmPelsWidth; \r
fgState.GameModeSize.Y = devMode.dmPelsHeight;\r
fgState.GameModeDepth = devMode.dmBitsPerPel;\r
ATOM atom;\r
\r
/* What we need to do is to initialize the fgDisplay global structure here. */\r
- fgDisplay.Instance = GetModuleHandle( NULL );\r
- fgDisplay.DisplayName= displayName ? strdup(displayName) : 0 ;\r
- atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc );\r
+ fgDisplay.pDisplay.Instance = GetModuleHandle( NULL );\r
+ fgDisplay.pDisplay.DisplayName= displayName ? strdup(displayName) : 0 ;\r
+ atom = GetClassInfo( fgDisplay.pDisplay.Instance, _T("FREEGLUT"), &wc );\r
\r
if( atom == 0 )\r
{\r
wc.lpfnWndProc = fgPlatformWindowProc;\r
wc.cbClsExtra = 0;\r
wc.cbWndExtra = 0;\r
- wc.hInstance = fgDisplay.Instance;\r
- wc.hIcon = LoadIcon( fgDisplay.Instance, _T("GLUT_ICON") );\r
+ wc.hInstance = fgDisplay.pDisplay.Instance;\r
+ wc.hIcon = LoadIcon( fgDisplay.pDisplay.Instance, _T("GLUT_ICON") );\r
\r
#if defined(_WIN32_WCE)\r
wc.style = CS_HREDRAW | CS_VREDRAW;\r
ReleaseDC( desktop, context );\r
}\r
/* If we have a DisplayName try to use it for metrics */\r
- if( fgDisplay.DisplayName )\r
+ if( fgDisplay.pDisplay.DisplayName )\r
{\r
- HDC context = CreateDC(fgDisplay.DisplayName,0,0,0);\r
+ HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0);\r
if( context )\r
{\r
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );\r
\r
void fgPlatformCloseDisplay ( void )\r
{\r
- if( fgDisplay.DisplayName )\r
+ if( fgDisplay.pDisplay.DisplayName )\r
{\r
- free( fgDisplay.DisplayName );\r
- fgDisplay.DisplayName = NULL;\r
+ free( fgDisplay.pDisplay.DisplayName );\r
+ fgDisplay.pDisplay.DisplayName = NULL;\r
}\r
\r
/* Reset the timer granularity */\r
#ifndef FREEGLUT_INTERNAL_MSWIN_H\r
#define FREEGLUT_INTERNAL_MSWIN_H\r
\r
+typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay;\r
+struct tagSFG_PlatformDisplay\r
+{\r
+ HINSTANCE Instance; /* The application's instance */\r
+ DEVMODE DisplayMode; /* Desktop's display settings */\r
+ char *DisplayName; /* Display name for multi display support*/ \r
+};\r
\r
\r
\r
/* create a dummy window */\r
ZeroMemory(&wndCls, sizeof(wndCls));\r
wndCls.lpfnWndProc = DefWindowProc;\r
- wndCls.hInstance = fgDisplay.Instance;\r
+ wndCls.hInstance = fgDisplay.pDisplay.Instance;\r
wndCls.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;\r
wndCls.lpszClassName = _T("FREEGLUT_dummy");\r
RegisterClass( &wndCls );\r
\r
- hWnd=CreateWindow(_T("FREEGLUT_dummy"), _T(""), WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW , 0,0,0,0, 0, 0, fgDisplay.Instance, 0 );\r
+ hWnd=CreateWindow(_T("FREEGLUT_dummy"), _T(""), WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW , 0,0,0,0, 0, 0, fgDisplay.pDisplay.Instance, 0 );\r
hDC=GetDC(hWnd);\r
SetPixelFormat( hDC, pixelformat, ppfd );\r
\r
wglDeleteContext(rc);\r
ReleaseDC(hWnd, hDC);\r
DestroyWindow(hWnd);\r
- UnregisterClass(_T("FREEGLUT_dummy"), fgDisplay.Instance);\r
+ UnregisterClass(_T("FREEGLUT_dummy"), fgDisplay.pDisplay.Instance);\r
}\r
\r
success = ( pixelformat != 0 ) && ( checkOnly || SetPixelFormat( current_hDC, pixelformat, ppfd ) );\r
\r
/* \r
* this function returns the origin of the screen identified by\r
- * fgDisplay.DisplayName, and 0 otherwise.\r
+ * fgDisplay.pDisplay.DisplayName, and 0 otherwise.\r
* This is used in fgOpenWindow to open the gamemode window on the screen\r
* identified by the -display command line argument. The function should\r
* not be called otherwise.\r
*xp = 0;\r
*yp = 0;\r
\r
- if( fgDisplay.DisplayName )\r
+ if( fgDisplay.pDisplay.DisplayName )\r
{\r
m_proc_t st;\r
st.x=xp;\r
st.y=yp;\r
- st.name=fgDisplay.DisplayName;\r
+ st.name=fgDisplay.pDisplay.DisplayName;\r
EnumDisplayMonitors(0,0,m_proc,(LPARAM)&st);\r
}\r
}\r
*xp = 0;\r
*yp = 0;\r
\r
- if( fgDisplay.DisplayName )\r
+ if( fgDisplay.pDisplay.DisplayName )\r
{\r
fgWarning( "for working -display support FreeGLUT must be compiled with WINVER >= 0x0500");\r
}\r
ATOM atom;\r
\r
/* Grab the window class we have registered on glutInit(): */\r
- atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc );\r
+ atom = GetClassInfo( fgDisplay.pDisplay.Instance, _T("FREEGLUT"), &wc );\r
FREEGLUT_INTERNAL_ERROR_EXIT ( atom, "Window Class Info Not Found",\r
"fgOpenWindow" );\r
\r
0,0, 240,320,\r
NULL,\r
NULL,\r
- fgDisplay.Instance,\r
+ fgDisplay.pDisplay.Instance,\r
(LPVOID) window\r
);\r
\r
x, y, w, h,\r
(HWND) window->Parent == NULL ? NULL : window->Parent->Window.Handle,\r
(HMENU) NULL,\r
- fgDisplay.Instance,\r
+ fgDisplay.pDisplay.Instance,\r
(LPVOID) window\r
);\r
#endif /* defined(_WIN32_WCE) */\r