now handling WM_MOUSEACTIVATE so that menus don't get activated upon mouseclick
authorDiederick Niehorster <dcnieho@gmail.com>
Sat, 6 Apr 2013 10:15:19 +0000 (10:15 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Sat, 6 Apr 2013 10:15:19 +0000 (10:15 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1607 7f0cb862-5218-0410-a997-914c9d46530a

src/mswin/fg_internal_mswin.h
src/mswin/fg_main_mswin.c

index ee52382..1ec651f 100644 (file)
@@ -96,7 +96,7 @@ struct tagSFG_PlatformWindowState
     DWORD           OldStyleEx;         /* window Ex style - stored before the window is made fullscreen */
     BOOL            OldMaximized;       /* window maximized state - stored before the window is made fullscreen */
 
-    GLboolean       MouseTracking;      /* Needed for generating GLUT_ENTERED and GLUT_LEFT entry func callbacks on windows */
+    BOOL            MouseTracking;      /* Needed for generating GLUT_ENTERED and GLUT_LEFT entry func callbacks on windows */
 
     /* Need to store window titles to emulate
      * glutSetIconTitle/glutSetWindowTitle as Windows has only
index f3d2005..a35bfca 100644 (file)
@@ -589,9 +589,20 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
         fgPlatformCheckMenuDeactivate();
         break;
 
+    case WM_MOUSEACTIVATE:
+        /* Clicks should not activate the menu.
+         * Especially important when clicking on a menu's submenu item which has no effect.
+         */
+        printf("WM_MOUSEACTIVATE\n");
+        if (window->IsMenu)
+            lRet = MA_NOACTIVATEANDEAT;
+        else
+            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));
+        /* printf("WM_ACTIVATE: %x (ID: %i) %d %d\n",lParam, window->ID, HIWORD(wParam), LOWORD(wParam)); */
         if (LOWORD(wParam) != WA_INACTIVE)
         {
 /*            printf("WM_ACTIVATE: fgSetCursor( %p, %d)\n", window,
@@ -629,7 +640,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
                     tme.hwndTrack = window->Window.Handle;
                     TrackMouseEvent(&tme);
 
-                    window->State.pWState.MouseTracking = GL_TRUE;
+                    window->State.pWState.MouseTracking = TRUE;
                 }
             }
         }
@@ -648,7 +659,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
             INVOKE_WCB( *window, Entry, ( GLUT_LEFT ) );
             fgSetWindow(saved_window);
 
-            window->State.pWState.MouseTracking = GL_FALSE;
+            window->State.pWState.MouseTracking = FALSE;
             lRet = 0;   /* As per docs, must return zero */
         }
         break;