diff --git a/freeglut/freeglut/src/freeglut_window.c b/freeglut/freeglut/src/freeglut_window.c index 4663aba..800342d 100644 --- a/freeglut/freeglut/src/freeglut_window.c +++ b/freeglut/freeglut/src/freeglut_window.c @@ -31,6 +31,7 @@ #if TARGET_HOST_POSIX_X11 #include /* LONG_MAX */ +#include /* usleep */ #endif #if defined(_WIN32_WCE) @@ -905,6 +906,14 @@ static void get_display_origin(int *xp,int *yp) #endif +#if TARGET_HOST_POSIX_X11 +static Bool fghWindowIsVisible( Display *display, XEvent *event, XPointer arg) +{ + Window window = arg; + return (event->type == MapNotify) && (event->xmap.window == window); +} +#endif + /* * Opens a window. Requires a SFG_Window object created and attached @@ -921,6 +930,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, XTextProperty textProperty; XSizeHints sizeHints; XWMHints wmHints; + XEvent eventReturnBuffer; /* return buffer required for a call */ unsigned long mask; int num_FBConfigs, i; unsigned int current_DisplayMode = fgState.DisplayMode ; @@ -1114,6 +1124,9 @@ void fgOpenWindow( SFG_Window* window, const char* title, XFree(visualInfo); + if( !isSubWindow) + XPeekIfEvent( fgDisplay.Display, &eventReturnBuffer, &fghWindowIsVisible, window->Window.Handle ); + #elif TARGET_HOST_MS_WINDOWS WNDCLASS wc;