X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_window_x11.c;h=b6943d3a3de8dbc8ce41357a73be797c287890b3;hb=99d53f15a4216240088132f6af9cb194b519b1cc;hp=6f927c2c454facefc057430fde7e62f6384a51f5;hpb=33809048f02c69b63bc8ac4a0fafc7f6eaf4a363;p=freeglut diff --git a/src/x11/fg_window_x11.c b/src/x11/fg_window_x11.c index 6f927c2..b6943d3 100644 --- a/src/x11/fg_window_x11.c +++ b/src/x11/fg_window_x11.c @@ -32,8 +32,6 @@ #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 @@ -48,11 +46,14 @@ static int fghResizeFullscrToggle(void) if(glutGet(GLUT_FULL_SCREEN)) { /* restore original window size */ SFG_Window *win = fgStructure.CurrentWindow; - fgStructure.CurrentWindow->State.NeedToResize = GL_TRUE; - fgStructure.CurrentWindow->State.Width = win->State.pWState.OldWidth; - fgStructure.CurrentWindow->State.Height = win->State.pWState.OldHeight; + fgStructure.CurrentWindow->State.WorkMask = GLUT_SIZE_WORK; + fgStructure.CurrentWindow->State.DesiredWidth = win->State.pWState.OldWidth; + fgStructure.CurrentWindow->State.DesiredHeight = win->State.pWState.OldHeight; } else { + fgStructure.CurrentWindow->State.pWState.OldWidth = win->State.Width; + fgStructure.CurrentWindow->State.pWState.OldHeight = win->State.Height; + /* resize the window to cover the entire screen */ XGetWindowAttributes(fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, @@ -383,15 +384,6 @@ void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height ) /* - * 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 ) @@ -412,35 +404,35 @@ void fgPlatformCloseWindow( SFG_Window* window ) /* - * This function makes the current window visible + * This function makes the specified window visible */ -void fgPlatformGlutShowWindow( void ) +void fgPlatformShowWindow( SFG_Window *window ) { - XMapWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); + XMapWindow( fgDisplay.pDisplay.Display, window->Window.Handle ); XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ } /* - * This function hides the current window + * This function hides the specified window */ -void fgPlatformGlutHideWindow( void ) +void fgPlatformHideWindow( SFG_Window *window ) { - if( fgStructure.CurrentWindow->Parent == NULL ) + if( window->Parent == NULL ) XWithdrawWindow( fgDisplay.pDisplay.Display, - fgStructure.CurrentWindow->Window.Handle, + window->Window.Handle, fgDisplay.pDisplay.Screen ); else XUnmapWindow( fgDisplay.pDisplay.Display, - fgStructure.CurrentWindow->Window.Handle ); + window->Window.Handle ); XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ } /* - * Iconify the current window (top-level windows only) + * Iconify the specified window (top-level windows only) */ -void fgPlatformGlutIconifyWindow( void ) +void fgPlatformIconifyWindow( SFG_Window *window ) { - XIconifyWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, + XIconifyWindow( fgDisplay.pDisplay.Display, window->Window.Handle, fgDisplay.pDisplay.Screen ); XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ @@ -490,59 +482,35 @@ void fgPlatformGlutSetIconTitle( const char* title ) } /* - * Change the current window's position + * Change the specified window's position */ -void fgPlatformGlutPositionWindow( int x, int y ) +void fgPlatformPositionWindow( SFG_Window *window, int x, int y ) { - XMoveWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, + XMoveWindow( fgDisplay.pDisplay.Display, window->Window.Handle, x, y ); XFlush( fgDisplay.pDisplay.Display ); /* XXX Shouldn't need this */ } /* - * Lowers the current window (by Z order change) - */ -void fgPlatformGlutPushWindow( void ) -{ - XLowerWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); -} - -/* - * Raises the current window (by Z order change) - */ -void fgPlatformGlutPopWindow( void ) -{ - XRaiseWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle ); -} - -/* - * Resize the current window so that it fits the whole screen + * Lowers the specified window (by Z order change) */ -void fgPlatformGlutFullScreen( SFG_Window *win ) +void fgPlatformPushWindow( SFG_Window *window ) { - if(!glutGet(GLUT_FULL_SCREEN)) { - if(fghToggleFullscreen() != -1) { - win->State.IsFullscreen = GL_TRUE; - } - } + XLowerWindow( fgDisplay.pDisplay.Display, window->Window.Handle ); } /* - * If we are fullscreen, resize the current window back to its original size + * Raises the specified window (by Z order change) */ -void fgPlatformGlutLeaveFullScreen( SFG_Window *win ) +void fgPlatformPopWindow( SFG_Window *window ) { - if(glutGet(GLUT_FULL_SCREEN)) { - if(fghToggleFullscreen() != -1) { - win->State.IsFullscreen = GL_FALSE; - } - } + XRaiseWindow( fgDisplay.pDisplay.Display, window->Window.Handle ); } /* * Toggle the window's full screen state. */ -void fgPlatformGlutFullScreenToggle( SFG_Window *win ) +void fgPlatformFullScreenToggle( SFG_Window *win ) { if(fghToggleFullscreen() != -1) { win->State.IsFullscreen = !win->State.IsFullscreen;