Implementing John Tsiombikas' game mode patch per e-mail dated 3/15/11 8:04 PM
[freeglut] / src / freeglut_window.c
index 800342d..fc9fc55 100644 (file)
@@ -1316,6 +1316,12 @@ void fgOpenWindow( SFG_Window* window, const char* title,
  */
 void fgCloseWindow( SFG_Window* window )
 {
+    /* if we're in gamemode, call glutLeaveGameMode first to make sure the
+     * gamemode is properly closed before closing the window
+     */
+    if (fgStructure.GameModeWindow != NULL)
+        glutLeaveGameMode();
+
 #if TARGET_HOST_POSIX_X11
 
     if( window->Window.Context )