From 2ea7e1534b6ff0db4b835608c8b2d2c18629a19e Mon Sep 17 00:00:00 2001 From: Richard Rauch Date: Sat, 7 Feb 2004 12:10:26 +0000 Subject: [PATCH] Ooops. We don't want people to be able to create a subwindow of an offscreen window. (^& This is no longer permitted. (Actually, it would be nice if it would work, but I don't think that you can subwindow a pixmap in UNIX_X11, and assume that subwindowing offscreen doesn't work on WIN32, either.) git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@456 7f0cb862-5218-0410-a997-914c9d46530a --- src/freeglut_window.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/freeglut_window.c b/src/freeglut_window.c index f99b673..2fc1d29 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -645,14 +645,20 @@ int FGAPIENTRY glutCreateWindow( const char* title ) */ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h ) { - SFG_Window* window = NULL; - SFG_Window* parent = NULL; - - freeglut_assert_ready; - parent = fgWindowByID( parentID ); - freeglut_return_val_if_fail( parent != NULL, 0 ); - window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE ); - return window->ID; + int ret = 0; + + if( GL_FALSE == fgStructure.Window->State.IsOffscreen ) + { + SFG_Window* window = NULL; + SFG_Window* parent = NULL; + + freeglut_assert_ready; + parent = fgWindowByID( parentID ); + freeglut_return_val_if_fail( parent != NULL, 0 ); + window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE ); + ret = window->ID; + } + return ret; } /* -- 1.7.10.4