and with 0xFF to indicate to runtime that we want to strip out higher bits - otherwis...
[freeglut] / src / mswin / fg_main_mswin.c
index b3062ef..6100ae1 100644 (file)
@@ -296,7 +296,7 @@ static LRESULT fghWindowProcKeyPress(SFG_Window *window, UINT uMsg, GLboolean ke
                 wParam=code[ 0 ];
 
             INVOKE_WCB( *window, KeyboardUp,
-                   ( (char)wParam,
+                   ( (char)(wParam & 0xFF), /* and with 0xFF to indicate to runtime that we want to strip out higher bits - otherwise we get a runtime error when "Smaller Type Checks" is enabled */
                         window->State.MouseX, window->State.MouseY )
             );
         }
@@ -1345,7 +1345,7 @@ void fgPlatformProcessWork(SFG_Window *window)
         {
         case DesireHiddenState:
             cmdShow = SW_HIDE;
-               break;
+            break;
         case DesireIconicState:
             cmdShow = SW_MINIMIZE;
             /* Call on top-level window */
@@ -1353,7 +1353,10 @@ void fgPlatformProcessWork(SFG_Window *window)
                 win = win->Parent;
             break;
         case DesireNormalState:
-            cmdShow = SW_SHOW;
+            if (win->IsMenu)
+                cmdShow = SW_SHOWNOACTIVATE;    /* Just show, don't activate if its a menu */
+            else
+                cmdShow = SW_SHOW;
             break;
         }