if( menuEntry != menu->ActiveEntry )
{
- menu->Window->State.Redisplay = GL_TRUE;
+ menu->Window->State.WorkMask |= GLUT_DISPLAY_WORK;
if( menu->ActiveEntry )
menu->ActiveEntry->IsActive = GL_FALSE;
}
( !menu->ActiveEntry->SubMenu ||
!menu->ActiveEntry->SubMenu->IsActive ) )
{
- menu->Window->State.Redisplay = GL_TRUE;
+ menu->Window->State.WorkMask |= GLUT_DISPLAY_WORK;
menu->ActiveEntry->IsActive = GL_FALSE;
menu->ActiveEntry = NULL;
}
fgSetWindow( parent_window );
fgStructure.CurrentMenu = active_menu;
- /* Deactivate menu and then call callback (we don't want menu to stay in view while callback is executing) */
+ /* Deactivate menu and then call callback (we don't want menu to stay in view while callback is executing, and user should be able to change menus in callback) */
fgDeactivateMenu( parent_window );
active_menu->Callback( active_entry->ID );
is_handled = GL_TRUE;
}
- else if ( fgStructure.Menus.First ) /* Don't have to check whether this was a downpress or an uppress, there is no way to get an uppress in another window before a downpress... */
+ else if ( fgState.ActiveMenus ) /* Don't have to check whether this was a downpress or an uppress, there is no way to get an uppress in another window before a downpress... */
{
/* if another window than the one clicked in has an open menu, close it */
SFG_Menu *menu = fgGetActiveMenu();
{
/* The menu object creation code resides in freeglut_structure.c */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
return fgCreateMenu( callback )->ID;
menu = fgMenuByID( menuID );
freeglut_return_if_fail( menu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
/* The menu object destruction code resides in freeglut_structure.c */
menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
menuEntry->Text = strdup( label );
subMenu = fgMenuByID( subMenuID );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
freeglut_return_if_fail( subMenu );
menu = fgMenuByID( menuID );
freeglut_return_if_fail( menu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
font = fghFontByID( fontID );
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToMenuEntry" );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
/* Get n-th menu entry in the current menu, starting from one: */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToSubMenu" );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
/* Get handle to sub menu */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutRemoveMenuItem" );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
/* Get n-th menu entry in the current menu, starting from one: */
freeglut_return_if_fail( fgStructure.CurrentWindow );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
freeglut_return_if_fail( button >= 0 );
freeglut_return_if_fail( fgStructure.CurrentWindow );
freeglut_return_if_fail( fgStructure.CurrentMenu );
- if (fgGetActiveMenu())
+ if (fgState.ActiveMenus)
fgError("Menu manipulation not allowed while menus in use.");
freeglut_return_if_fail( button >= 0 );