X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffg_menu.c;h=daad294a7ee64a5289ca524da9739eb0b1be38a6;hb=002dae879eda329f38fe65cb6f99d4f481a2eb47;hp=cad5b83f84c60333ede8a9e59a46a8346bf4b2a1;hpb=76bb5e2f2b60a3cb15fe7fa0142d80a89065cf30;p=freeglut diff --git a/src/fg_menu.c b/src/fg_menu.c index cad5b83..daad294 100644 --- a/src/fg_menu.c +++ b/src/fg_menu.c @@ -531,7 +531,7 @@ static void fghActivateMenu( SFG_Window* window, int button ) 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 ); @@ -725,7 +725,7 @@ void fgDeactivateMenu( SFG_Window *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); } } } @@ -784,23 +784,30 @@ int FGAPIENTRY glutCreateMenuUcall( FGCBMenuUC callback, FGCBUserData userData ) { /* 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."); + if (fgState.ActiveMenus) + { + 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 ) { FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" ); - return glutCreateMenuUcall( glutCreateMenuCallback, (FGCBUserData)callback ); + if (!callback) + { + return glutCreateMenuUcall( NULL, NULL ); + } + FGCBMenu* reference = &callback; + return glutCreateMenuUcall( fghCreateMenuCallback, *((FGCBUserData*)reference) ); } /*