From 6c3c78f5fe46f0126e26dcae456ebdec502913f5 Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Sat, 4 Feb 2012 14:29:34 +0000 Subject: [PATCH] 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: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1045 7f0cb862-5218-0410-a997-914c9d46530a --- src/Common/freeglut_spaceball.c | 2 +- src/Common/freeglut_state.c | 18 ++++---- src/Common/freeglut_window.c | 90 +++++++++++++++++++-------------------- src/x11/freeglut_xinput_x11.c | 6 +-- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/Common/freeglut_spaceball.c b/src/Common/freeglut_spaceball.c index 89655f4..4901e79 100644 --- a/src/Common/freeglut_spaceball.c +++ b/src/Common/freeglut_spaceball.c @@ -77,7 +77,7 @@ void fgInitialiseSpaceball(void) } 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; return; diff --git a/src/Common/freeglut_state.c b/src/Common/freeglut_state.c index 6630b6d..8962df3 100644 --- a/src/Common/freeglut_state.c +++ b/src/Common/freeglut_state.c @@ -65,7 +65,7 @@ static int fghGetConfig( int attribute ) int result; /* Not checked */ if( fgStructure.CurrentWindow ) - result = glXGetFBConfigAttrib( fgDisplay.Display, + result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display, *(fgStructure.CurrentWindow->Window.pContext.FBConfig), attribute, &returnValue ); @@ -128,7 +128,7 @@ int fgPlatformGlutGet ( GLenum eWhat ) fgStructure.CurrentWindow->Window.pContext.FBConfig; XVisualInfo * visualInfo = - glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig ); + glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, *fbconfig ); const int result = visualInfo->visual->map_entries; @@ -153,7 +153,7 @@ int fgPlatformGlutGet ( GLenum eWhat ) return 0; XTranslateCoordinates( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, fgDisplay.RootWindow, 0, 0, &x, &y, &w); @@ -167,7 +167,7 @@ int fgPlatformGlutGet ( GLenum eWhat ) if ( w == 0 ) return 0; XTranslateCoordinates( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, w, 0, 0, &x, &y, &w); @@ -186,7 +186,7 @@ int fgPlatformGlutGet ( GLenum eWhat ) if( fgStructure.CurrentWindow == NULL ) return 0; XGetWindowAttributes( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, &winAttributes ); @@ -259,7 +259,7 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) */ { unsigned char map; - int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0); + int nbuttons = XGetPointerMapping(fgDisplay.pDisplay.Display, &map,0); return nbuttons; } @@ -633,8 +633,8 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size) break; } - fbconfigArray = glXChooseFBConfig(fgDisplay.Display, - fgDisplay.Screen, + fbconfigArray = glXChooseFBConfig(fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, attributes, &fbconfigArraySize); @@ -652,7 +652,7 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size) { int value; - result = glXGetFBConfigAttrib(fgDisplay.Display, + result = glXGetFBConfigAttrib(fgDisplay.pDisplay.Display, fbconfigArray[i], attribute_name, &value); diff --git a/src/Common/freeglut_window.c b/src/Common/freeglut_window.c index 1052c25..69aba28 100644 --- a/src/Common/freeglut_window.c +++ b/src/Common/freeglut_window.c @@ -259,8 +259,8 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs ) /* Get all FBConfigs that match "attributes". */ - fbconfigArray = glXChooseFBConfig( fgDisplay.Display, - fgDisplay.Screen, + fbconfigArray = glXChooseFBConfig( fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, attributes, &fbconfigArraySize ); @@ -281,13 +281,13 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs ) /* Get bufferSizeMin. */ result = - glXGetFBConfigAttrib( fgDisplay.Display, + glXGetFBConfigAttrib( fgDisplay.pDisplay.Display, fbconfigArray[0], GLX_BUFFER_SIZE, &bufferSizeMin ); /* Get bufferSizeMax. */ result = - glXGetFBConfigAttrib( fgDisplay.Display, + glXGetFBConfigAttrib( fgDisplay.pDisplay.Display, fbconfigArray[fbconfigArraySize - 1], GLX_BUFFER_SIZE, &bufferSizeMax ); @@ -305,7 +305,7 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs ) ATTRIB_VAL( GLX_BUFFER_SIZE, bufferSizeMax ); ATTRIB( None ); - fbconfigArray = glXChooseFBConfig( fgDisplay.Display, + fbconfigArray = glXChooseFBConfig( fgDisplay.pDisplay.Display, fgDisplay.Screen, attributes, &fbconfigArraySize ); @@ -319,7 +319,7 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs ) * int fbconfigXID; * * - pick the XID of the FBConfig we want - * result = glXGetFBConfigAttrib( fgDisplay.Display, + * result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display, * fbconfigArray[0], * GLX_FBCONFIG_ID, * &fbconfigXID ); @@ -333,8 +333,8 @@ GLXFBConfig* fgChooseFBConfig( int *numcfgs ) * ATTRIB( None ); * * - get our FBConfig only - * fbconfig = glXChooseFBConfig( fgDisplay.Display, - * fgDisplay.Screen, + * fbconfig = glXChooseFBConfig( fgDisplay.pDisplay.Display, + * fgDisplay.pDisplay.Screen, * attributes, * &fbconfigArraySize ); * @@ -397,7 +397,7 @@ static GLXContext fghCreateNewContext( SFG_Window* window ) int index_mode = ( fgState.DisplayMode & GLUT_INDEX ); /* "classic" context creation */ - Display *dpy = fgDisplay.Display; + Display *dpy = fgDisplay.pDisplay.Display; GLXFBConfig config = *(window->Window.pContext.FBConfig); int render_type = ( !menu && index_mode ) ? GLX_COLOR_INDEX_TYPE : GLX_RGBA_TYPE; GLXContext share_list = NULL; @@ -454,7 +454,7 @@ static int fghResizeFullscrToggle(void) } else { /* resize the window to cover the entire screen */ - XGetWindowAttributes(fgDisplay.Display, + XGetWindowAttributes(fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, &attributes); @@ -462,7 +462,7 @@ static int fghResizeFullscrToggle(void) * The "x" and "y" members of "attributes" are the window's coordinates * relative to its parent, i.e. to the decoration window. */ - XMoveResizeWindow(fgDisplay.Display, + XMoveResizeWindow(fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, -attributes.x, -attributes.y, @@ -491,7 +491,7 @@ static int fghEwmhFullscrToggle(void) xev.xclient.data.l[3] = 1; /* source indication: application */ 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 0; @@ -516,7 +516,7 @@ void fgPlatformSetWindow ( SFG_Window *window ) if ( window ) { glXMakeContextCurrent( - fgDisplay.Display, + fgDisplay.pDisplay.Display, window->Window.Handle, window->Window.Handle, window->Window.Context @@ -580,7 +580,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, /* Get the X visual. */ for (i = 0; i < num_FBConfigs; i++) { - visualInfo = glXGetVisualFromFBConfig( fgDisplay.Display, + visualInfo = glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, window->Window.pContext.FBConfig[i] ); if (visualInfo) break; @@ -609,7 +609,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, winAttr.border_pixel = 0; winAttr.colormap = XCreateColormap( - fgDisplay.Display, fgDisplay.RootWindow, + fgDisplay.pDisplay.Display, fgDisplay.pDisplay.RootWindow, visualInfo->visual, AllocNone ); @@ -627,8 +627,8 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, w = h = 300; /* default window size */ window->Window.Handle = XCreateWindow( - fgDisplay.Display, - window->Parent == NULL ? fgDisplay.RootWindow : + fgDisplay.pDisplay.Display, + window->Parent == NULL ? fgDisplay.pDisplay.RootWindow : window->Parent->Window.Handle, x, y, w, h, 0, visualInfo->depth, InputOutput, @@ -668,7 +668,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, window->Window.Context = fghCreateNewContext( window ); #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 ) 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 ); XSetWMProperties( - fgDisplay.Display, + fgDisplay.pDisplay.Display, window->Window.Handle, &textProperty, &textProperty, @@ -719,11 +719,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, ); XFree( textProperty.value ); - XSetWMProtocols( fgDisplay.Display, window->Window.Handle, - &fgDisplay.DeleteWindow, 1 ); + XSetWMProtocols( fgDisplay.pDisplay.Display, window->Window.Handle, + &fgDisplay.pDisplay.DeleteWindow, 1 ); glXMakeContextCurrent( - fgDisplay.Display, + fgDisplay.pDisplay.Display, window->Window.Handle, window->Window.Handle, window->Window.Context @@ -731,15 +731,15 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, /* register extension events _before_ window is mapped */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - fgRegisterDevices( fgDisplay.Display, &(window->Window.Handle) ); + fgRegisterDevices( fgDisplay.pDisplay.Display, &(window->Window.Handle) ); #endif - XMapWindow( fgDisplay.Display, window->Window.Handle ); + XMapWindow( fgDisplay.pDisplay.Display, window->Window.Handle ); XFree(visualInfo); 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 ) { if( window->Window.Context ) - glXDestroyContext( fgDisplay.Display, window->Window.Context ); + glXDestroyContext( fgDisplay.pDisplay.Display, window->Window.Context ); XFree( window->Window.pContext.FBConfig ); 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 ) { - XMapWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); - XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ + XMapWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); + XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ } /* @@ -783,13 +783,13 @@ void fgPlatformGlutShowWindow( void ) void fgPlatformGlutHideWindow( void ) { if( fgStructure.CurrentWindow->Parent == NULL ) - XWithdrawWindow( fgDisplay.Display, + XWithdrawWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, - fgDisplay.Screen ); + fgDisplay.pDisplay.Screen ); else - XUnmapWindow( fgDisplay.Display, + XUnmapWindow( fgDisplay.pDisplay.Display, 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 ) { - XIconifyWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, - fgDisplay.Screen ); - XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ + XIconifyWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, + fgDisplay.pDisplay.Screen ); + XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ } /* @@ -815,12 +815,12 @@ void fgPlatformGlutSetWindowTitle( const char* title ) text.nitems = strlen( title ); XSetWMName( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, &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 ); XSetWMIconName( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, &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 ) { - XMoveWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle, + XMoveWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, 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 ) { - 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 ) { - XRaiseWindow( fgDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); + XRaiseWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); } /* diff --git a/src/x11/freeglut_xinput_x11.c b/src/x11/freeglut_xinput_x11.c index 40677fa..54adf72 100644 --- a/src/x11/freeglut_xinput_x11.c +++ b/src/x11/freeglut_xinput_x11.c @@ -28,7 +28,7 @@ void fgRegisterDevices( Display* dpy, Window* win ) { unsigned char flags[2] = { 0, 0 }; int event, error; - /*Display* dpy = fgDisplay.Display; + /*Display* dpy = fgDisplay.pDisplay.Display; Window* win = glutGetXWindow();*/ /* get XInput extension opcode */ @@ -148,7 +148,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) { int i, button = 0; 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); /*printf("XI2 event type: %d - %d\n", cookie->evtype, event->type );*/ @@ -212,7 +212,7 @@ void fgHandleExtensionEvents( XEvent* base_ev ) { } fgState.Modifiers = INVALID_MODIFIERS; } - XFreeEventData( fgDisplay.Display, cookie ); + XFreeEventData( fgDisplay.pDisplay.Display, cookie ); } #endif -- 1.7.10.4