Tweaking for menu behavior in Linux regarding mouse whatnot - John Fay
authorJ.C. Jones <jc@insufficient.coffee>
Sat, 4 Oct 2003 15:06:42 +0000 (15:06 +0000)
committerJ.C. Jones <jc@insufficient.coffee>
Sat, 4 Oct 2003 15:06:42 +0000 (15:06 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@212 7f0cb862-5218-0410-a997-914c9d46530a

ChangeLog
src/freeglut_main.c
src/freeglut_structure.c

index acde6eb..b0ab896 100644 (file)
--- a/ChangeLog
+++ b/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
index 8fddc90..c6eaa64 100644 (file)
@@ -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 ;
index 9c515c8..09ad74d 100644 (file)
@@ -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...