diff --git a/freeglut/freeglut/ChangeLog b/freeglut/freeglut/ChangeLog index acde6eb..b0ab896 100644 --- a/freeglut/freeglut/ChangeLog +++ b/freeglut/freeglut/ChangeLog @@ -322,5 +322,12 @@ October 24, 2002: (110) Fixed compiliation of freeglut_joystick.c on FreeBSD +******************************************************************************************* +* Freeglut 2.0.0 Released on September 29, 2003! +******************************************************************************************* + +******************************************************************************************* +* Changes on October 3, 2003 +******************************************************************************************* - +(110) Tweaking for the menu behavior on Linux regarding mice, etc. - John Fay diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 8fddc90..c6eaa64 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -752,17 +752,23 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ if( window->ActiveMenu != NULL ) { + if ( window == window->ActiveMenu->ParentWindow ) + { + window->ActiveMenu->Window->State.MouseX = event.xmotion.x_root - window->ActiveMenu->X ; + window->ActiveMenu->Window->State.MouseY = event.xmotion.y_root - window->ActiveMenu->Y ; + } + /* * Let's make the window redraw as a result of the mouse motion. */ - window->State.Redisplay = TRUE ; + window->ActiveMenu->Window->State.Redisplay = TRUE ; /* * Since the window is a menu, make the parent window current */ fgSetWindow ( window->ActiveMenu->ParentWindow ) ; - break; + break; /* I think this should stay in -- an active menu should absorb the mouse motion */ } /* @@ -847,7 +853,13 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ if ( window->ActiveMenu != NULL ) /* Window has an active menu, it absorbs any mouse click */ { - if ( fgCheckActiveMenu ( window, window->ActiveMenu ) == TRUE ) /* Inside the menu, invoke the callback and deactivate the menu*/ + if ( window == window->ActiveMenu->ParentWindow ) + { + window->ActiveMenu->Window->State.MouseX = event.xbutton.x_root - window->ActiveMenu->X ; + window->ActiveMenu->Window->State.MouseY = event.xbutton.y_root - window->ActiveMenu->Y ; + } + + if ( fgCheckActiveMenu ( window->ActiveMenu->Window, window->ActiveMenu ) == TRUE ) /* Inside the menu, invoke the callback and deactivate the menu*/ { /* Save the current window and menu and set the current window to the window whose menu this is */ SFG_Window *save_window = fgStructure.Window ; diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index 9c515c8..09ad74d 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -273,6 +273,7 @@ void fgCloseWindows () void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) { SFG_Window* subWindow; + int menu_index ; assert( window != NULL ); freeglut_assert_ready; @@ -309,6 +310,15 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) else fgListRemove( &fgStructure.Windows, &window->Node ); + if ( window->ActiveMenu != NULL ) + fgDeactivateMenu ( window ) ; + + for ( menu_index = 0; menu_index < 3; menu_index ++ ) + { + if ( window->Menu[menu_index] != NULL ) + window->Menu[menu_index]->ParentWindow = NULL ; + } + /* * OK, this window seems disconnected from the structure enough * in order to be closed without any bigger risks...