X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffreeglut_internal.h;h=2b93afbdbc39e410a6cf9a93687896b182563fc0;hb=98ea79ef777bea593a87aef9600ee3d4fda6e110;hp=9cfe936f51c121ddd54c35db1e1ed7be33eedd00;hpb=224638013a9db16bbbe6e3ff05d6cac9a939c262;p=freeglut diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index 9cfe936..2b93afb 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -77,6 +77,7 @@ #include #include #if TARGET_HOST_UNIX_X11 +#include #include #endif @@ -198,9 +199,11 @@ struct tagSFG_Time }; /* - * An enumeration containing the state of the GLUT execution: initializing, running, or stopping + * An enumeration containing the state of the GLUT execution: + * initializing, running, or stopping */ -typedef enum { +typedef enum +{ GLUT_EXEC_STATE_INIT, GLUT_EXEC_STATE_RUNNING, GLUT_EXEC_STATE_STOP @@ -216,6 +219,8 @@ struct tagSFG_State SFG_XYUse Size; /* The default windows' size */ unsigned int DisplayMode; /* Display mode for new windows */ + GLboolean Initialised; /* freeglut has been initialised */ + GLboolean ForceDirectContext; /* Force direct rendering? */ GLboolean TryDirectContext; /* What about giving a try to? */ @@ -226,6 +231,7 @@ struct tagSFG_State GLboolean XSyncSwitch; /* X11 sync protocol switch */ GLboolean IgnoreKeyRepeat; /* Whether to ignore key repeat. */ + int Modifiers; /* Current ALT/SHIFT/CTRL state */ GLuint FPSInterval; /* Interval between FPS printfs */ GLuint SwapCount; /* Count of glutSwapBuffer calls */ @@ -236,7 +242,6 @@ struct tagSFG_State FGCBIdle IdleCallback; /* The global idle callback */ - GLboolean BuildingAMenu; /* Are we presently making a menu */ int ActiveMenus; /* Num. of currently active menus */ FGCBMenuState MenuStateCallback; /* Menu callbacks are global */ FGCBMenuStatus MenuStatusCallback; @@ -339,7 +344,6 @@ struct tagSFG_WindowState GLboolean Visible; /* Is the window visible now */ int Cursor; /* The currently selected cursor */ - int Modifiers; /* The current ALT/SHIFT/CTRL state */ long JoystickPollRate; /* The joystick polling rate */ long JoystickLastPoll; /* When the last poll has happened */ @@ -348,9 +352,7 @@ struct tagSFG_WindowState GLboolean IsGameMode; /* Is this the game mode window? */ -#if TARGET_HOST_WIN32 - GLboolean NeedToResize; /* Do we need to explicitly resize? */ -#endif + GLboolean NeedToResize; /* Do we need to resize the window? */ }; @@ -363,8 +365,7 @@ struct tagSFG_WindowState * {Visibility} is the window-specific callback to fetch. * * The result is correctly type-cast to the callback function pointer - * type. (This is accomlished by abutting the callback name to a - * common prefix, using ANSI C token-pasting.) + * type. */ #define FETCH_WCB(window,cbname) \ ((FGCB ## cbname)((window).CallBacks[CB_ ## cbname])) @@ -389,13 +390,14 @@ struct tagSFG_WindowState * */ #define INVOKE_WCB(window,cbname,arg_list) \ +do \ { \ if( FETCH_WCB( window, cbname ) ) \ { \ fgSetWindow( &window ); \ FETCH_WCB( window, cbname ) arg_list; \ } \ -} +} while( 0 ) /* * The window callbacks the user can supply us with. Should be kept portable. @@ -641,7 +643,7 @@ extern SFG_State fgState; * A call to this function makes us sure that the Display and Structure * subsystems have been properly initialized and are ready to be used */ -#define freeglut_assert_ready assert( fgState.Time.Set ); +#define freeglut_assert_ready assert( fgState.Initialised ); /* * Following definitions are somewhat similiar to GLib's, @@ -652,7 +654,7 @@ extern SFG_State fgState; return; #define freeglut_return_val_if_fail( expr, val ) \ if( !(expr) ) \ - return( val ); + return val ; /* * A call to those macros assures us that there is a current @@ -697,19 +699,22 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, /* * Window creation, opening, closing and destruction. + * Also CallBack clearing/initialization. * Defined in freeglut_structure.c, freeglut_window.c. */ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, - int x, int y, int w, int h, GLboolean gameMode ); -void fgSetWindow ( SFG_Window *window ) ; + int x, int y, int w, int h, + GLboolean gameMode, GLboolean isMenu ); +void fgSetWindow ( SFG_Window *window ); void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, GLboolean gameMode, - int isSubWindow ); + GLboolean isSubWindow ); void fgCloseWindow( SFG_Window* window ); void fgAddToWindowDestroyList ( SFG_Window* window, - GLboolean needToClose ) ; + GLboolean needToClose ); void fgCloseWindows (); void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ); +void fgClearCallBacks( SFG_Window *window ); /* * Menu creation and destruction. Defined in freeglut_structure.c