From 6c8a620bd5259471e7a8e79023401083ecee6930 Mon Sep 17 00:00:00 2001 From: jtsiomb Date: Thu, 10 May 2012 18:50:52 +0000 Subject: [PATCH] Applied Thomas Bastiani's patch fixing the behaviour of freeglut under X11 when operating without a window manager. Adds a fake ConfigureNotify event to make sure reshape callbacks are called at least once as specified. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1313 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/x11/fg_window_x11.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/freeglut/freeglut/src/x11/fg_window_x11.c b/freeglut/freeglut/src/x11/fg_window_x11.c index 1b90bf5..61a3bd6 100644 --- a/freeglut/freeglut/src/x11/fg_window_x11.c +++ b/freeglut/freeglut/src/x11/fg_window_x11.c @@ -133,6 +133,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 +240,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