From: Diederick Niehorster Date: Sat, 6 Apr 2013 10:15:19 +0000 (+0000) Subject: now handling WM_MOUSEACTIVATE so that menus don't get activated upon mouseclick X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=9721970dce1ebac6b6bb3c7b0b84fdada7216270;p=freeglut now handling WM_MOUSEACTIVATE so that menus don't get activated upon mouseclick git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1607 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/mswin/fg_internal_mswin.h b/src/mswin/fg_internal_mswin.h index ee52382..1ec651f 100644 --- a/src/mswin/fg_internal_mswin.h +++ b/src/mswin/fg_internal_mswin.h @@ -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 diff --git a/src/mswin/fg_main_mswin.c b/src/mswin/fg_main_mswin.c index f3d2005..a35bfca 100644 --- a/src/mswin/fg_main_mswin.c +++ b/src/mswin/fg_main_mswin.c @@ -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;