X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_window_x11.c;h=6f927c2c454facefc057430fde7e62f6384a51f5;hb=56cc35535901ef071bf8acab59ba176355ee3e0e;hp=1b90bf55c5922eaec8b237e6a102910ae0c112d6;hpb=0e653a9d94fec583f7a4172b721c1c599e06cbc8;p=freeglut diff --git a/src/x11/fg_window_x11.c b/src/x11/fg_window_x11.c index 1b90bf5..6f927c2 100644 --- a/src/x11/fg_window_x11.c +++ b/src/x11/fg_window_x11.c @@ -32,6 +32,8 @@ #include /* usleep */ #include "../fg_internal.h" +extern void fghRedrawWindow(SFG_Window *window); + #ifdef EGL_VERSION_1_0 #include "egl/fg_window_egl.h" #define fghCreateNewContext fghCreateNewContextEGL @@ -133,6 +135,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, XEvent eventReturnBuffer; /* return buffer required for a call */ unsigned long mask; unsigned int current_DisplayMode = fgState.DisplayMode ; + XConfigureEvent fakeEvent = {0}; /* Save the display mode if we are creating a menu window */ if( window->IsMenu && ( ! fgStructure.MenuContext ) ) @@ -239,6 +242,18 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, &winAttr ); + /* Fake configure event to force viewport setup + * even with no window manager. + */ + fakeEvent.type = ConfigureNotify; + fakeEvent.display = fgDisplay.pDisplay.Display; + fakeEvent.window = window->Window.Handle; + fakeEvent.x = x; + fakeEvent.y = y; + fakeEvent.width = w; + fakeEvent.height = h; + XPutBackEvent(fgDisplay.pDisplay.Display, (XEvent*)&fakeEvent); + /* * The GLX context creation, possibly trying the direct context rendering * or else use the current context if the user has so specified @@ -357,6 +372,26 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, /* + * Request a window resize + */ +void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height ) +{ + XResizeWindow( fgDisplay.pDisplay.Display, window->Window.Handle, + width, height ); + XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ +} + + +/* + * A static helper function to execute display callback for a window + */ +void fgPlatformDisplayWindow ( SFG_Window *window ) +{ + fghRedrawWindow ( window ) ; +} + + +/* * Closes a window, destroying the frame and OpenGL context */ void fgPlatformCloseWindow( SFG_Window* window ) @@ -408,6 +443,8 @@ void fgPlatformGlutIconifyWindow( void ) XIconifyWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, fgDisplay.pDisplay.Screen ); XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ + + fgStructure.CurrentWindow->State.Visible = GL_FALSE; } /*