Taking care of keeping things mostly up-to-date
[freeglut] / src / freeglut_main.c
index 34c3f79..64c7884 100644 (file)
@@ -265,7 +265,7 @@ static void fghcbCheckJoystickPolls( SFG_Window *window, SFG_Enumerator *enumera
     /*
      * Check if actually need to do the poll for the currently enumerated window:
      */
-    if( window->State.JoystickLastPoll + window->State.JoystickPollRate >= checkTime )
+    if( window->State.JoystickLastPoll + window->State.JoystickPollRate <= checkTime )
     {
         /*
          * Yeah, that's it. Poll the joystick...
@@ -1507,12 +1507,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
             /* Save the current window and menu and set the current window to the window whose menu this is */
             SFG_Window *save_window = fgStructure.Window ;
             SFG_Menu *save_menu = fgStructure.Menu ;
+            SFG_Window *parent_window = window->ActiveMenu->ParentWindow ;
             fgSetWindow ( window ) ;
             fgStructure.Menu = window->ActiveMenu ;
 
             /* Execute the menu callback */
             fgExecuteMenuCallback ( window->ActiveMenu ) ;
-            fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
+            fgDeactivateMenu ( parent_window ) ;
 
             /* Restore the current window and menu */
             fgSetWindow ( save_window ) ;