X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_menu_mswin.c;h=93c538ef6501e36bb4310f4967474b431f529978;hb=6090a1ed96f3eb4c90f1f38ec9cd37ae0fe9b30e;hp=d198cca81b45ca01d8715c69f09ecd24a2ac0650;hpb=5b3d339481bac6dbaeb599bffc1325f716585bfe;p=freeglut diff --git a/src/mswin/fg_menu_mswin.c b/src/mswin/fg_menu_mswin.c index d198cca..93c538e 100644 --- a/src/mswin/fg_menu_mswin.c +++ b/src/mswin/fg_menu_mswin.c @@ -30,12 +30,34 @@ #include "../fg_internal.h" + GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ) { *x = glutGet ( GLUT_SCREEN_WIDTH ); *y = glutGet ( GLUT_SCREEN_HEIGHT ); } +void fgPlatformCheckMenuDeactivate(HWND newFocusWnd) +{ + /* User/system switched application focus. + * If we have an open menu, close it. + */ + SFG_Menu* menu = NULL; + + if ( fgState.ActiveMenus ) + menu = fgGetActiveMenu(); + + if ( menu ) + { + if (newFocusWnd != menu->Window->Window.Handle) + /* When in GameMode, the menu's parent window will lose focus when the menu is opened. + * This is sadly necessary as we need to do an activating ShowWindow() for the menu + * to pop up over the gamemode window + */ + fgDeactivateMenu(menu->ParentWindow); + } +}; + /* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */