X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffg_menu.c;h=65ec6741be5beff0fc74cb9fc7a1a38d7d0b19b1;hb=84bbdfc8e7dfb2e220a4d155159be91e88ea9433;hp=0c6c64e5842f3709f5574b96d03d9e20d7df6ae7;hpb=49e61d9b74ae8520b5b7fddbcfc727081ac54391;p=freeglut diff --git a/src/fg_menu.c b/src/fg_menu.c index 0c6c64e..65ec674 100644 --- a/src/fg_menu.c +++ b/src/fg_menu.c @@ -29,6 +29,7 @@ #include #include "fg_internal.h" + /* -- DEFINITIONS ---------------------------------------------------------- */ /* @@ -403,7 +404,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * 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 ) { @@ -620,11 +621,12 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed, /* * 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 @@ -659,12 +661,13 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed, 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; @@ -689,7 +692,7 @@ void fgDeactivateMenu( SFG_Window *window ) { 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 ); }