Fixing two minor bugs, adding comments
authorJohn F. Fay <johnffay@nettally.com>
Thu, 21 Sep 2006 17:33:56 +0000 (17:33 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Thu, 21 Sep 2006 17:33:56 +0000 (17:33 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@697 7f0cb862-5218-0410-a997-914c9d46530a

ChangeLog
src/freeglut_internal.h
src/freeglut_joystick.c
src/freeglut_main.c
src/freeglut_window.c

index 1f8c5d7..41397d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1184,3 +1184,15 @@ original GLUT.
 (306)  Changed "fgStructure.GameMode" to "fgStructure.GameModeWindow" to
 reflect better what it is
 
+**************************************************************************
+* Changes on September 21, 2006
+**************************************************************************
+
+(307)  Added an end-of-line character to a warning message about an unknown
+X event type
+
+(308)  Fixing a problem in which "glutGetWindow" would return a menu's window
+instead of the menu's parent window
+
+(309)  Added some handy comments, spacing, fixed a typo in a comment
+
index ca751f3..8ce6f7f 100644 (file)
@@ -77,13 +77,15 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
 #define strdup   _strdup
 #endif
 
-/* Those files should be available on every platform. */
+/* These files should be available on every platform. */
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
 #include <stdlib.h>
+
+/* These are included based on autoconf directives. */
 #if HAVE_SYS_TYPES_H
 #    include <sys/types.h>
 #endif
@@ -126,6 +128,8 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
 #    define  FALSE  0
 #endif
 
+/* General defines */
+
 #define INVALID_MODIFIERS 0xffffffff
 
 /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
@@ -284,7 +288,7 @@ struct tagSFG_Display
     int             DisplayPointerX;    /* saved X location of the pointer   */
     int             DisplayPointerY;    /* saved Y location of the pointer   */
 
-#endif
+#endif /* X_XF86VidModeGetModeLine */
 
 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
     HINSTANCE        Instance;          /* The application's instance        */
index af7c54c..eba92a2 100644 (file)
@@ -980,7 +980,7 @@ static void fghJoystickAddHatElement ( SFG_Joystick *joy, CFDictionaryRef button
    http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp
  */
 #    if defined(_MSC_VER)
-#        pragma comment (lib, "advapi32.lib")
+#        pragma comment (lib, "advapi32.lib") /* library pragmas are bad */
 #    endif
 
 static int fghJoystickGetOEMProductName ( SFG_Joystick* joy, char *buf, int buf_sz )
index 8ade92b..302a16e 100644 (file)
@@ -69,7 +69,7 @@ struct GXKeyList gxKeyList;
 #endif
 
 #ifndef MIN
-#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#    define MIN(a,b) (((a)<(b)) ? (a) : (b))
 #endif
 
 
@@ -1404,7 +1404,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
             break; /* XXX Should disable this event */
 
         default:
-            fgWarning ("Unknown X event type: %d", event.type);
+            fgWarning ("Unknown X event type: %d\n", event.type);
             break;
         }
     }
index af29425..4a702ad 100644 (file)
@@ -30,7 +30,7 @@
 
 #if TARGET_HOST_WINCE
 #include <aygshell.h>
-#pragma comment( lib, "Aygshell.lib" )
+#pragma comment( lib, "Aygshell.lib" ) /* library pragmas are bad */
 
 static wchar_t* fghWstrFromStr(const char* str)
 {
@@ -764,10 +764,11 @@ void FGAPIENTRY glutSetWindow( int ID )
  */
 int FGAPIENTRY glutGetWindow( void )
 {
+    SFG_Window *win = fgStructure.CurrentWindow;
     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetWindow" );
-    if( fgStructure.CurrentWindow == NULL )
-        return 0;
-    return fgStructure.CurrentWindow->ID;
+    while ( win && win->IsMenu )
+        win = win->Parent;
+    return win ? win->ID : 0;
 }
 
 /*