now that menu's no longer take focus from their parent, clicking the non-client area...
authorDiederick Niehorster <dcnieho@gmail.com>
Sat, 6 Apr 2013 10:16:27 +0000 (10:16 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Sat, 6 Apr 2013 10:16:27 +0000 (10:16 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1609 7f0cb862-5218-0410-a997-914c9d46530a

src/mswin/fg_main_mswin.c

index f1c6eb7..3128c2e 100644 (file)
@@ -983,6 +983,20 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
             lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
         break;
 
+    case WM_NCLBUTTONDOWN:
+    case WM_NCMBUTTONDOWN:
+    case WM_NCRBUTTONDOWN:
+        {
+            SFG_Menu *menu;
+            if (fgStructure.Menus.First && (menu = fgGetActiveMenu()))
+                /* user clicked non-client area of window while a menu is open. Close menu */
+                fgDeactivateMenu(menu->ParentWindow);
+
+            /* and always pass to DefWindowProc */
+            lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
+        }
+        break;
+
 #if 0
     case WM_ACTIVATE:
         /* printf("WM_ACTIVATE: %x (ID: %i) %d %d\n",lParam, window->ID, HIWORD(wParam), LOWORD(wParam)); */