Fixing mouse wheel bug in Windows per e-mail from Ioannis Petikas dated 5/9/12 at...
[freeglut] / src / mswin / fg_main_mswin.c
index 0f7f4ae..15e9102 100644 (file)
@@ -689,7 +689,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
         /*
          * XXX Should use WHEEL_DELTA instead of 120
          */
-               if ( abs ( fgState.MouseWheelTicks ) > 120 )
+               if ( abs ( fgState.MouseWheelTicks ) >= 120 )
                {
                        int direction = ( fgState.MouseWheelTicks > 0 ) ? 1 : -1;
 
@@ -703,7 +703,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             /*
              * XXX Should use WHEEL_DELTA instead of 120
              */
-            while( abs ( fgState.MouseWheelTicks ) > 120 )
+            while( abs ( fgState.MouseWheelTicks ) >= 120 )
                        {
                 if( FETCH_WCB( *window, MouseWheel ) )
                     INVOKE_WCB( *window, MouseWheel,
@@ -794,6 +794,12 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             KEY( VK_DOWN,   GLUT_KEY_DOWN      );
             KEY( VK_INSERT, GLUT_KEY_INSERT    );
 
+        case VK_LCONTROL:  case VK_RCONTROL:  case VK_CONTROL:
+        case VK_LSHIFT:    case VK_RSHIFT:    case VK_SHIFT:
+        case VK_LMENU:     case VK_RMENU:     case VK_MENU:
+            /* These keypresses and releases are handled earlier in the function */
+            break;
+
         case VK_DELETE:
             /* The delete key should be treated as an ASCII keypress: */
             INVOKE_WCB( *window, Keyboard,
@@ -880,6 +886,12 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             KEY( VK_DOWN,   GLUT_KEY_DOWN      );
             KEY( VK_INSERT, GLUT_KEY_INSERT    );
 
+          case VK_LCONTROL:  case VK_RCONTROL:  case VK_CONTROL:
+          case VK_LSHIFT:    case VK_RSHIFT:    case VK_SHIFT:
+          case VK_LMENU:     case VK_RMENU:     case VK_MENU:
+              /* These keypresses and releases are handled earlier in the function */
+              break;
+
           case VK_DELETE:
               /* The delete key should be treated as an ASCII keypress: */
               INVOKE_WCB( *window, KeyboardUp,