#include <GL/freeglut.h>
#include "fg_internal.h"
+
/* -- DEFINITIONS ---------------------------------------------------------- */
/*
/*
* Private static function to set the parent window of a submenu and all
- * of its submenus
+ * of its submenus.
*/
static void fghSetMenuParentWindow( SFG_Window *window, SFG_Menu *menu )
{
/*
* Outside the menu, deactivate if it's a downclick
*
- * XXX This isn't enough. A downclick outside of
- * XXX the interior of our freeglut windows should also
- * XXX deactivate the menu. This is more complicated.
+ * A downclick outside of the interior of our freeglut windows
+ * is dealt with in the WM_KILLFOCUS handler of fgPlatformWindowProc
*/
+ {
fgDeactivateMenu( window->ActiveMenu->ParentWindow );
+ }
/*
* XXX Why does an active menu require a redisplay at
void fgDeactivateMenu( SFG_Window *window )
{
SFG_Window *parent_window = NULL;
-
- /* Check if there is an active menu attached to this window... */
- SFG_Menu* menu = window->ActiveMenu;
+ SFG_Menu* menu;
SFG_MenuEntry *menuEntry;
/* Did we find an active window? */
+ freeglut_return_if_fail( window );
+ /* Check if there is an active menu attached to this window... */
+ menu = window->ActiveMenu;
freeglut_return_if_fail( menu );
parent_window = menu->ParentWindow;
{
menuEntry->IsActive = GL_FALSE;
- /* Is that an active submenu by any case? */
+ /* Is that an active submenu by any chance? */
if( menuEntry->SubMenu )
fghDeactivateSubMenu( menuEntry );
}