static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
{
if( fgStructure.GameModeWindow )
- fgPlatformGetGameModeVMaxExtent ( window, x, y );
+ fgPlatformGetGameModeVMaxExtent ( window, x, y );
else
{
*x = fgDisplay.ScreenWidth;
fgState.MenuStateCallback(GLUT_MENU_IN_USE);
if (fgState.MenuStatusCallback)
/* window->State.MouseX and window->State.MouseY are relative to client area origin, as needed */
- fgState.MenuStatusCallback(GLUT_MENU_IN_USE, window->State.MouseX, window->State.MouseY);
+ fgState.MenuStatusCallback(GLUT_MENU_IN_USE, window->State.MouseX, window->State.MouseY, fgState.MenuStatusCallbackData);
}
fgSetWindow( menu->Window );
SFG_XYUse mouse_pos;
fghPlatformGetCursorPos(parent_window, GL_TRUE, &mouse_pos);
- fgState.MenuStatusCallback(GLUT_MENU_NOT_IN_USE, mouse_pos.X, mouse_pos.Y);
+ fgState.MenuStatusCallback(GLUT_MENU_NOT_IN_USE, mouse_pos.X, mouse_pos.Y, fgState.MenuStatusCallbackData);
}
}
}
/* The menu object creation code resides in fg_structure.c */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" );
if (fgState.ActiveMenus)
- fgError("Menu manipulation not allowed while menus in use.");
+ {
+ fgError( "Menu manipulation not allowed while menus in use." );
+ }
return fgCreateMenu( callback, userData )->ID;
}
/* Standard glutCreateMenu */
-void glutCreateMenuCallback( int menu, FGCBUserData userData )
+static void fghCreateMenuCallback( int menu, FGCBUserData userData )
{
- FGCBMenu callback = (FGCBMenu)userData;
- callback( menu );
+ FGCBMenu* callback = (FGCBMenu*)&userData;
+ (*callback)( menu );
}
int FGAPIENTRY glutCreateMenu( FGCBMenu callback )
{
+ FGCBMenu* reference;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" );
- return glutCreateMenuUcall( glutCreateMenuCallback, (FGCBUserData)callback );
+ if (!callback)
+ {
+ return glutCreateMenuUcall( NULL, NULL );
+ }
+ reference = &callback;
+ return glutCreateMenuUcall( fghCreateMenuCallback, *((FGCBUserData*)reference) );
}
/*