Combined EnterNotify and LeaveNotify event processing in the UNIX_X11
[freeglut] / src / freeglut_main.c
index fd0abbc..fb8f9bb 100644 (file)
@@ -619,20 +619,13 @@ void FGAPIENTRY glutMainLoopEvent( void )
         break;
 
         case EnterNotify:
-        {
-            GETWINDOW( xcrossing );
-            GETMOUSE( xcrossing );
-            INVOKE_WCB( *window, Entry, ( GLUT_ENTERED ) );
-        }
-        break;
-        /* XXX Combine EnterNotify and LeaveNotify */
         case LeaveNotify:
-        {
             GETWINDOW( xcrossing );
             GETMOUSE( xcrossing );
-            INVOKE_WCB( *window, Entry, ( GLUT_LEFT ) );
-        }
-        break;
+            INVOKE_WCB( *window, Entry, ( ( EnterNotify == event.type ) ?
+                                          GLUT_ENTERED :
+                                          GLUT_LEFT ) );
+            break;
 
         case MotionNotify:
         {
@@ -819,14 +812,14 @@ void FGAPIENTRY glutMainLoopEvent( void )
                  * XXX since the order and numbering isn't certain
                  * XXX See XFree86 configuration docs (even back in the
                  * XXX 3.x days, and especially with 4.x).
-                *
-                * XXX Note that {button} has already been decremeted
-                * XXX in mapping from X button numbering to GLUT.
+                 *
+                 * XXX Note that {button} has already been decremeted
+                 * XXX in mapping from X button numbering to GLUT.
                  */
                 int wheel_number = (button - 3) / 2;
-               int direction = -1;
-               if( button % 2 )
-                   direction = 1;
+                int direction = -1;
+                if( button % 2 )
+                    direction = 1;
                 
                 if( pressed )
                     INVOKE_WCB( *window, MouseWheel, ( wheel_number,
@@ -952,6 +945,9 @@ void FGAPIENTRY glutMainLoopEvent( void )
         }
         break;
 
+        case ReparentNotify:
+            break; /* XXX Should disable this event */
+
         default:
             fgWarning ("Unknown X event type: %d", event.type);
             break;