projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding Window Exit event handling to the Windows code; also adding a note that eventu...
[freeglut]
/
src
/
freeglut_internal.h
diff --git
a/src/freeglut_internal.h
b/src/freeglut_internal.h
index
a3804ba
..
0226214
100644
(file)
--- a/
src/freeglut_internal.h
+++ b/
src/freeglut_internal.h
@@
-370,10
+370,10
@@
typedef void (*SFG_Proc)();
/*
* SET_WCB() is used as:
*
/*
* SET_WCB() is used as:
*
- * SET_WCB( window, Visibility, func );
+ * SET_WCB( window, cbname, func );
*
* ...where {window} is the freeglut window to set the callback,
*
* ...where {window} is the freeglut window to set the callback,
- * {Visibility} is the window-specific callback to set,
+ * {cbname} is the window-specific callback to set,
* {func} is a function-pointer.
*
* Originally, {FETCH_WCB( ... ) = func} was rather sloppily used,
* {func} is a function-pointer.
*
* Originally, {FETCH_WCB( ... ) = func} was rather sloppily used,
@@
-394,29
+394,29
@@
do \
/*
* FETCH_WCB() is used as:
*
/*
* FETCH_WCB() is used as:
*
- * FETCH_WCB( window, Visibility );
+ * FETCH_WCB( window, cbname );
*
* ...where {window} is the freeglut window to fetch the callback from,
*
* ...where {window} is the freeglut window to fetch the callback from,
- * {Visibility} is the window-specific callback to fetch.
+ * {cbname} is the window-specific callback to fetch.
*
* The result is correctly type-cast to the callback function pointer
* type.
*/
#define FETCH_WCB(window,cbname) \
*
* The result is correctly type-cast to the callback function pointer
* type.
*/
#define FETCH_WCB(window,cbname) \
- ((FGCB ## cbname)((window).CallBacks[CB_ ## cbname]))
+ ((window).CallBacks[CB_ ## cbname])
/*
* INVOKE_WCB() is used as:
*
/*
* INVOKE_WCB() is used as:
*
- * INVOKE_WCB( window, Visibility, ( status ) );
+ * INVOKE_WCB( window, cbname, ( arg_list ) );
*
* ...where {window} is the freeglut window,
*
* ...where {window} is the freeglut window,
- * {Visibility} is the window-specific callback,
- * {(status)} is the parameter list.
+ * {cbname} is the window-specific callback to be invoked,
+ * {(arg_list)} is the parameter list.
*
* The callback is invoked as:
*
*
* The callback is invoked as:
*
- * callback( status );
+ * callback( arg_list );
*
* ...so the parentheses are REQUIRED in the {arg_list}.
*
*
* ...so the parentheses are REQUIRED in the {arg_list}.
*
@@
-424,15
+424,28
@@
do \
* current window.
*
*/
* current window.
*
*/
+#if TARGET_HOST_WIN32
#define INVOKE_WCB(window,cbname,arg_list) \
do \
{ \
if( FETCH_WCB( window, cbname ) ) \
{ \
#define INVOKE_WCB(window,cbname,arg_list) \
do \
{ \
if( FETCH_WCB( window, cbname ) ) \
{ \
+ FGCB ## cbname func = (FGCB ## cbname)(FETCH_WCB( window, cbname )); \
fgSetWindow( &window ); \
fgSetWindow( &window ); \
- FETCH_WCB( window, cbname ) arg_list; \
+ func arg_list; \
} \
} while( 0 )
} \
} while( 0 )
+#else
+#define INVOKE_WCB(window,cbname,arg_list) \
+do \
+{ \
+ if( FETCH_WCB( window, cbname ) ) \
+ { \
+ fgSetWindow( &window ); \
+ ((FGCB ## cbname)FETCH_WCB( window, cbname )) arg_list; \
+ } \
+} while( 0 )
+#endif
/*
* The window callbacks the user can supply us with. Should be kept portable.
/*
* The window callbacks the user can supply us with. Should be kept portable.
@@
-569,8
+582,8
@@
struct tagSFG_Structure
SFG_List Menus; /* The global menus list */
SFG_List WindowsToDestroy;
SFG_List Menus; /* The global menus list */
SFG_List WindowsToDestroy;
- SFG_Window* Window; /* The currently active win. */
- SFG_Menu* Menu; /* Same, but menu... */
+ SFG_Window* CurrentWindow; /* The currently set window */
+ SFG_Menu* CurrentMenu; /* Same, but menu... */
SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */
@@
-693,7
+706,7
@@
extern SFG_State fgState;
* window set, respectively:
*/
#define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \
* window set, respectively:
*/
#define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \
- if ( ! fgStructure.Window ) \
+ if ( ! fgStructure.CurrentWindow ) \
{ \
fgError ( " ERROR: Function <%s> called" \
" with no current window defined.", (string) ) ; \
{ \
fgError ( " ERROR: Function <%s> called" \
" with no current window defined.", (string) ) ; \