From 22deb0baa11494b2cd2ab127e77f143a44b899a4 Mon Sep 17 00:00:00 2001 From: fayjf Date: Thu, 21 Sep 2006 17:33:56 +0000 Subject: [PATCH] Fixing two minor bugs, adding comments git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@697 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/ChangeLog | 12 ++++++++++++ freeglut/freeglut/src/freeglut_internal.h | 8 ++++++-- freeglut/freeglut/src/freeglut_joystick.c | 2 +- freeglut/freeglut/src/freeglut_main.c | 4 ++-- freeglut/freeglut/src/freeglut_window.c | 9 +++++---- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/freeglut/freeglut/ChangeLog b/freeglut/freeglut/ChangeLog index 1f8c5d7..41397d5 100644 --- a/freeglut/freeglut/ChangeLog +++ b/freeglut/freeglut/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 + diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index ca751f3..8ce6f7f 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -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 #include #include #include #include #include + +/* These are included based on autoconf directives. */ #if HAVE_SYS_TYPES_H # include #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 */ diff --git a/freeglut/freeglut/src/freeglut_joystick.c b/freeglut/freeglut/src/freeglut_joystick.c index af7c54c..eba92a2 100644 --- a/freeglut/freeglut/src/freeglut_joystick.c +++ b/freeglut/freeglut/src/freeglut_joystick.c @@ -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 ) diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 8ade92b..302a16e 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -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; } } diff --git a/freeglut/freeglut/src/freeglut_window.c b/freeglut/freeglut/src/freeglut_window.c index af29425..4a702ad 100644 --- a/freeglut/freeglut/src/freeglut_window.c +++ b/freeglut/freeglut/src/freeglut_window.c @@ -30,7 +30,7 @@ #if TARGET_HOST_WINCE #include -#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; } /*