Changing a bunch of platform-specific "fgDisplay" fields to "fgDisplay.pDisplay" -- I can't see how the X11 version built before this.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1045 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2012-02-04 14:29:34 +00:00
parent 8c452d5b4d
commit e9d4340061
4 changed files with 58 additions and 58 deletions

View File

@ -77,7 +77,7 @@ void fgInitialiseSpaceball(void)
} }
w = fgStructure.CurrentWindow->Window.Handle; w = fgStructure.CurrentWindow->Window.Handle;
if(spnav_x11_open(fgDisplay.Display, w) == -1) if(spnav_x11_open(fgDisplay.pDisplay.Display, w) == -1)
{ {
sball_initialized = -1; sball_initialized = -1;
return; return;

View File

@ -65,7 +65,7 @@ static int fghGetConfig( int attribute )
int result; /* Not checked */ int result; /* Not checked */
if( fgStructure.CurrentWindow ) if( fgStructure.CurrentWindow )
result = glXGetFBConfigAttrib( fgDisplay.Display, result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display,
*(fgStructure.CurrentWindow->Window.pContext.FBConfig), *(fgStructure.CurrentWindow->Window.pContext.FBConfig),
attribute, attribute,
&returnValue ); &returnValue );
@ -128,7 +128,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
fgStructure.CurrentWindow->Window.pContext.FBConfig; fgStructure.CurrentWindow->Window.pContext.FBConfig;
XVisualInfo * visualInfo = XVisualInfo * visualInfo =
glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig ); glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, *fbconfig );
const int result = visualInfo->visual->map_entries; const int result = visualInfo->visual->map_entries;
@ -153,7 +153,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
return 0; return 0;
XTranslateCoordinates( XTranslateCoordinates(
fgDisplay.Display, fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.RootWindow, fgDisplay.RootWindow,
0, 0, &x, &y, &w); 0, 0, &x, &y, &w);
@ -167,7 +167,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
if ( w == 0 ) if ( w == 0 )
return 0; return 0;
XTranslateCoordinates( XTranslateCoordinates(
fgDisplay.Display, fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
w, 0, 0, &x, &y, &w); w, 0, 0, &x, &y, &w);
@ -186,7 +186,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
if( fgStructure.CurrentWindow == NULL ) if( fgStructure.CurrentWindow == NULL )
return 0; return 0;
XGetWindowAttributes( XGetWindowAttributes(
fgDisplay.Display, fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
&winAttributes &winAttributes
); );
@ -259,7 +259,7 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat )
*/ */
{ {
unsigned char map; unsigned char map;
int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0); int nbuttons = XGetPointerMapping(fgDisplay.pDisplay.Display, &map,0);
return nbuttons; return nbuttons;
} }
@ -633,8 +633,8 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size)
break; break;
} }
fbconfigArray = glXChooseFBConfig(fgDisplay.Display, fbconfigArray = glXChooseFBConfig(fgDisplay.pDisplay.Display,
fgDisplay.Screen, fgDisplay.pDisplay.Screen,
attributes, attributes,
&fbconfigArraySize); &fbconfigArraySize);
@ -652,7 +652,7 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size)
{ {
int value; int value;
result = glXGetFBConfigAttrib(fgDisplay.Display, result = glXGetFBConfigAttrib(fgDisplay.pDisplay.Display,
fbconfigArray[i], fbconfigArray[i],
attribute_name, attribute_name,
&value); &value);

View File

@ -259,8 +259,8 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs )
/* Get all FBConfigs that match "attributes". */ /* Get all FBConfigs that match "attributes". */
fbconfigArray = glXChooseFBConfig( fgDisplay.Display, fbconfigArray = glXChooseFBConfig( fgDisplay.pDisplay.Display,
fgDisplay.Screen, fgDisplay.pDisplay.Screen,
attributes, attributes,
&fbconfigArraySize ); &fbconfigArraySize );
@ -281,13 +281,13 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs )
/* Get bufferSizeMin. */ /* Get bufferSizeMin. */
result = result =
glXGetFBConfigAttrib( fgDisplay.Display, glXGetFBConfigAttrib( fgDisplay.pDisplay.Display,
fbconfigArray[0], fbconfigArray[0],
GLX_BUFFER_SIZE, GLX_BUFFER_SIZE,
&bufferSizeMin ); &bufferSizeMin );
/* Get bufferSizeMax. */ /* Get bufferSizeMax. */
result = result =
glXGetFBConfigAttrib( fgDisplay.Display, glXGetFBConfigAttrib( fgDisplay.pDisplay.Display,
fbconfigArray[fbconfigArraySize - 1], fbconfigArray[fbconfigArraySize - 1],
GLX_BUFFER_SIZE, GLX_BUFFER_SIZE,
&bufferSizeMax ); &bufferSizeMax );
@ -305,7 +305,7 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs )
ATTRIB_VAL( GLX_BUFFER_SIZE, bufferSizeMax ); ATTRIB_VAL( GLX_BUFFER_SIZE, bufferSizeMax );
ATTRIB( None ); ATTRIB( None );
fbconfigArray = glXChooseFBConfig( fgDisplay.Display, fbconfigArray = glXChooseFBConfig( fgDisplay.pDisplay.Display,
fgDisplay.Screen, fgDisplay.Screen,
attributes, attributes,
&fbconfigArraySize ); &fbconfigArraySize );
@ -319,7 +319,7 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs )
* int fbconfigXID; * int fbconfigXID;
* *
* - pick the XID of the FBConfig we want * - pick the XID of the FBConfig we want
* result = glXGetFBConfigAttrib( fgDisplay.Display, * result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display,
* fbconfigArray[0], * fbconfigArray[0],
* GLX_FBCONFIG_ID, * GLX_FBCONFIG_ID,
* &fbconfigXID ); * &fbconfigXID );
@ -333,8 +333,8 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs )
* ATTRIB( None ); * ATTRIB( None );
* *
* - get our FBConfig only * - get our FBConfig only
* fbconfig = glXChooseFBConfig( fgDisplay.Display, * fbconfig = glXChooseFBConfig( fgDisplay.pDisplay.Display,
* fgDisplay.Screen, * fgDisplay.pDisplay.Screen,
* attributes, * attributes,
* &fbconfigArraySize ); * &fbconfigArraySize );
* *
@ -397,7 +397,7 @@ static GLXContext fghCreateNewContext( SFG_Window* window )
int index_mode = ( fgState.DisplayMode & GLUT_INDEX ); int index_mode = ( fgState.DisplayMode & GLUT_INDEX );
/* "classic" context creation */ /* "classic" context creation */
Display *dpy = fgDisplay.Display; Display *dpy = fgDisplay.pDisplay.Display;
GLXFBConfig config = *(window->Window.pContext.FBConfig); GLXFBConfig config = *(window->Window.pContext.FBConfig);
int render_type = ( !menu && index_mode ) ? GLX_COLOR_INDEX_TYPE : GLX_RGBA_TYPE; int render_type = ( !menu && index_mode ) ? GLX_COLOR_INDEX_TYPE : GLX_RGBA_TYPE;
GLXContext share_list = NULL; GLXContext share_list = NULL;
@ -454,7 +454,7 @@ static int fghResizeFullscrToggle(void)
} else { } else {
/* resize the window to cover the entire screen */ /* resize the window to cover the entire screen */
XGetWindowAttributes(fgDisplay.Display, XGetWindowAttributes(fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
&attributes); &attributes);
@ -462,7 +462,7 @@ static int fghResizeFullscrToggle(void)
* The "x" and "y" members of "attributes" are the window's coordinates * The "x" and "y" members of "attributes" are the window's coordinates
* relative to its parent, i.e. to the decoration window. * relative to its parent, i.e. to the decoration window.
*/ */
XMoveResizeWindow(fgDisplay.Display, XMoveResizeWindow(fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
-attributes.x, -attributes.x,
-attributes.y, -attributes.y,
@ -491,7 +491,7 @@ static int fghEwmhFullscrToggle(void)
xev.xclient.data.l[3] = 1; /* source indication: application */ xev.xclient.data.l[3] = 1; /* source indication: application */
xev.xclient.data.l[4] = 0; /* unused */ xev.xclient.data.l[4] = 0; /* unused */
if(!XSendEvent(fgDisplay.Display, fgDisplay.RootWindow, 0, evmask, &xev)) { if(!XSendEvent(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.RootWindow, 0, evmask, &xev)) {
return -1; return -1;
} }
return 0; return 0;
@ -516,7 +516,7 @@ void fgPlatformSetWindow ( SFG_Window *window )
if ( window ) if ( window )
{ {
glXMakeContextCurrent( glXMakeContextCurrent(
fgDisplay.Display, fgDisplay.pDisplay.Display,
window->Window.Handle, window->Window.Handle,
window->Window.Handle, window->Window.Handle,
window->Window.Context window->Window.Context
@ -580,7 +580,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
/* Get the X visual. */ /* Get the X visual. */
for (i = 0; i < num_FBConfigs; i++) { for (i = 0; i < num_FBConfigs; i++) {
visualInfo = glXGetVisualFromFBConfig( fgDisplay.Display, visualInfo = glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display,
window->Window.pContext.FBConfig[i] ); window->Window.pContext.FBConfig[i] );
if (visualInfo) if (visualInfo)
break; break;
@ -609,7 +609,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
winAttr.border_pixel = 0; winAttr.border_pixel = 0;
winAttr.colormap = XCreateColormap( winAttr.colormap = XCreateColormap(
fgDisplay.Display, fgDisplay.RootWindow, fgDisplay.pDisplay.Display, fgDisplay.pDisplay.RootWindow,
visualInfo->visual, AllocNone visualInfo->visual, AllocNone
); );
@ -627,8 +627,8 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
w = h = 300; /* default window size */ w = h = 300; /* default window size */
window->Window.Handle = XCreateWindow( window->Window.Handle = XCreateWindow(
fgDisplay.Display, fgDisplay.pDisplay.Display,
window->Parent == NULL ? fgDisplay.RootWindow : window->Parent == NULL ? fgDisplay.pDisplay.RootWindow :
window->Parent->Window.Handle, window->Parent->Window.Handle,
x, y, w, h, 0, x, y, w, h, 0,
visualInfo->depth, InputOutput, visualInfo->depth, InputOutput,
@ -668,7 +668,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
window->Window.Context = fghCreateNewContext( window ); window->Window.Context = fghCreateNewContext( window );
#if !defined( __FreeBSD__ ) && !defined( __NetBSD__ ) #if !defined( __FreeBSD__ ) && !defined( __NetBSD__ )
if( !glXIsDirect( fgDisplay.Display, window->Window.Context ) ) if( !glXIsDirect( fgDisplay.pDisplay.Display, window->Window.Context ) )
{ {
if( fgState.DirectContext == GLUT_FORCE_DIRECT_CONTEXT ) if( fgState.DirectContext == GLUT_FORCE_DIRECT_CONTEXT )
fgError( "Unable to force direct context rendering for window '%s'", fgError( "Unable to force direct context rendering for window '%s'",
@ -707,7 +707,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
XStringListToTextProperty( (char **) &title, 1, &textProperty ); XStringListToTextProperty( (char **) &title, 1, &textProperty );
XSetWMProperties( XSetWMProperties(
fgDisplay.Display, fgDisplay.pDisplay.Display,
window->Window.Handle, window->Window.Handle,
&textProperty, &textProperty,
&textProperty, &textProperty,
@ -719,11 +719,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
); );
XFree( textProperty.value ); XFree( textProperty.value );
XSetWMProtocols( fgDisplay.Display, window->Window.Handle, XSetWMProtocols( fgDisplay.pDisplay.Display, window->Window.Handle,
&fgDisplay.DeleteWindow, 1 ); &fgDisplay.pDisplay.DeleteWindow, 1 );
glXMakeContextCurrent( glXMakeContextCurrent(
fgDisplay.Display, fgDisplay.pDisplay.Display,
window->Window.Handle, window->Window.Handle,
window->Window.Handle, window->Window.Handle,
window->Window.Context window->Window.Context
@ -731,15 +731,15 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
/* register extension events _before_ window is mapped */ /* register extension events _before_ window is mapped */
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
fgRegisterDevices( fgDisplay.Display, &(window->Window.Handle) ); fgRegisterDevices( fgDisplay.pDisplay.Display, &(window->Window.Handle) );
#endif #endif
XMapWindow( fgDisplay.Display, window->Window.Handle ); XMapWindow( fgDisplay.pDisplay.Display, window->Window.Handle );
XFree(visualInfo); XFree(visualInfo);
if( !isSubWindow) if( !isSubWindow)
XPeekIfEvent( fgDisplay.Display, &eventReturnBuffer, &fghWindowIsVisible, (XPointer)(window->Window.Handle) ); XPeekIfEvent( fgDisplay.pDisplay.Display, &eventReturnBuffer, &fghWindowIsVisible, (XPointer)(window->Window.Handle) );
} }
@ -749,13 +749,13 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
void fgPlatformCloseWindow( SFG_Window* window ) void fgPlatformCloseWindow( SFG_Window* window )
{ {
if( window->Window.Context ) if( window->Window.Context )
glXDestroyContext( fgDisplay.Display, window->Window.Context ); glXDestroyContext( fgDisplay.pDisplay.Display, window->Window.Context );
XFree( window->Window.pContext.FBConfig ); XFree( window->Window.pContext.FBConfig );
if( window->Window.Handle ) { if( window->Window.Handle ) {
XDestroyWindow( fgDisplay.Display, window->Window.Handle ); XDestroyWindow( fgDisplay.pDisplay.Display, window->Window.Handle );
} }
/* XFlush( fgDisplay.Display ); */ /* XXX Shouldn't need this */ /* XFlush( fgDisplay.pDisplay.Display ); */ /* XXX Shouldn't need this */
} }
@ -773,8 +773,8 @@ static Bool fghWindowIsVisible( Display *display, XEvent *event, XPointer arg)
*/ */
void fgPlatformGlutShowWindow( void ) void fgPlatformGlutShowWindow( void )
{ {
XMapWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); XMapWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
} }
/* /*
@ -783,13 +783,13 @@ void fgPlatformGlutShowWindow( void )
void fgPlatformGlutHideWindow( void ) void fgPlatformGlutHideWindow( void )
{ {
if( fgStructure.CurrentWindow->Parent == NULL ) if( fgStructure.CurrentWindow->Parent == NULL )
XWithdrawWindow( fgDisplay.Display, XWithdrawWindow( fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.Screen ); fgDisplay.pDisplay.Screen );
else else
XUnmapWindow( fgDisplay.Display, XUnmapWindow( fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle ); fgStructure.CurrentWindow->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
} }
/* /*
@ -797,9 +797,9 @@ void fgPlatformGlutHideWindow( void )
*/ */
void fgPlatformGlutIconifyWindow( void ) void fgPlatformGlutIconifyWindow( void )
{ {
XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, XIconifyWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.Screen ); fgDisplay.pDisplay.Screen );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
} }
/* /*
@ -815,12 +815,12 @@ void fgPlatformGlutSetWindowTitle( const char* title )
text.nitems = strlen( title ); text.nitems = strlen( title );
XSetWMName( XSetWMName(
fgDisplay.Display, fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
&text &text
); );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
} }
/* /*
@ -836,12 +836,12 @@ void fgPlatformGlutSetIconTitle( const char* title )
text.nitems = strlen( title ); text.nitems = strlen( title );
XSetWMIconName( XSetWMIconName(
fgDisplay.Display, fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
&text &text
); );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
} }
/* /*
@ -849,9 +849,9 @@ void fgPlatformGlutSetIconTitle( const char* title )
*/ */
void fgPlatformGlutPositionWindow( int x, int y ) void fgPlatformGlutPositionWindow( int x, int y )
{ {
XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, XMoveWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle,
x, y ); x, y );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */
} }
/* /*
@ -859,7 +859,7 @@ void fgPlatformGlutPositionWindow( int x, int y )
*/ */
void fgPlatformGlutPushWindow( void ) void fgPlatformGlutPushWindow( void )
{ {
XLowerWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); XLowerWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
} }
/* /*
@ -867,7 +867,7 @@ void fgPlatformGlutPushWindow( void )
*/ */
void fgPlatformGlutPopWindow( void ) void fgPlatformGlutPopWindow( void )
{ {
XRaiseWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); XRaiseWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle );
} }
/* /*

View File

@ -28,7 +28,7 @@ void fgRegisterDevices( Display* dpy, Window* win ) {
unsigned char flags[2] = { 0, 0 }; unsigned char flags[2] = { 0, 0 };
int event, error; int event, error;
/*Display* dpy = fgDisplay.Display; /*Display* dpy = fgDisplay.pDisplay.Display;
Window* win = glutGetXWindow();*/ Window* win = glutGetXWindow();*/
/* get XInput extension opcode */ /* get XInput extension opcode */
@ -148,7 +148,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) {
int i, button = 0; int i, button = 0;
XGenericEventCookie* cookie = (XGenericEventCookie*)&(base_ev->xcookie); XGenericEventCookie* cookie = (XGenericEventCookie*)&(base_ev->xcookie);
if ( XGetEventData( fgDisplay.Display, cookie ) && (cookie->type == GenericEvent) && (cookie->extension == xi_opcode) ) { if ( XGetEventData( fgDisplay.pDisplay.Display, cookie ) && (cookie->type == GenericEvent) && (cookie->extension == xi_opcode) ) {
XIDeviceEvent* event = (XIDeviceEvent*)(cookie->data); XIDeviceEvent* event = (XIDeviceEvent*)(cookie->data);
/*printf("XI2 event type: %d - %d\n", cookie->evtype, event->type );*/ /*printf("XI2 event type: %d - %d\n", cookie->evtype, event->type );*/
@ -212,7 +212,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) {
} }
fgState.Modifiers = INVALID_MODIFIERS; fgState.Modifiers = INVALID_MODIFIERS;
} }
XFreeEventData( fgDisplay.Display, cookie ); XFreeEventData( fgDisplay.pDisplay.Display, cookie );
} }
#endif #endif