now handling WM_MOUSEACTIVATE so that menus don't get activated upon mouseclick

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1607 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-04-06 10:15:19 +00:00
parent 23e0e585ef
commit 9e4fc43b36
2 changed files with 15 additions and 4 deletions

View 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

View 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;