diff options
author | Brian Paul <[email protected]> | 2002-06-17 23:38:14 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-06-17 23:38:14 +0000 |
commit | 10d7f540ff48aba45225463b36a5c274e5c8e173 (patch) | |
tree | 7f19aecf82e742f4f0eb9affb0e71b724ab6437a /src | |
parent | 85d816028a2472e0378afda65e7ab6f7ff4d76b4 (diff) |
new fix for initial window size problem
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 4 | ||||
-rw-r--r-- | src/mesa/main/context.c | 36 |
2 files changed, 35 insertions, 5 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 288eeff6b9f..1ef83c12cfe 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1,4 +1,4 @@ -/* $Id: xm_api.c,v 1.38 2002/06/16 01:11:10 brianp Exp $ */ +/* $Id: xm_api.c,v 1.39 2002/06/17 23:38:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1277,8 +1277,6 @@ static GLboolean initialize_visual_and_buffer( int client, get_drawable_size( v->display, window, &w, &h ); b->width = w; b->height = h; - b->mesa_buffer.Width = w; - b->mesa_buffer.Height = h; b->frontbuffer = window; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c8c6b99b243..0b3e23aafd6 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.170 2002/06/17 23:36:31 brianp Exp $ */ +/* $Id: context.c,v 1.171 2002/06/17 23:38:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2169,7 +2169,39 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, newCtx->DrawBuffer = drawBuffer; newCtx->ReadBuffer = readBuffer; newCtx->NewState |= _NEW_BUFFERS; - /* _mesa_update_state( newCtx ); */ + + if (drawBuffer->Width == 0 && drawBuffer->Height == 0) { + /* get initial window size */ + GLuint bufWidth, bufHeight; + + /* ask device driver for size of output buffer */ + (*newCtx->Driver.GetBufferSize)( drawBuffer, &bufWidth, &bufHeight ); + + if (drawBuffer->Width == bufWidth && drawBuffer->Height == bufHeight) + return; /* size is as expected */ + + drawBuffer->Width = bufWidth; + drawBuffer->Height = bufHeight; + + newCtx->Driver.ResizeBuffers( drawBuffer ); + } + + if (readBuffer != drawBuffer && + readBuffer->Width == 0 && readBuffer->Height == 0) { + /* get initial window size */ + GLuint bufWidth, bufHeight; + + /* ask device driver for size of output buffer */ + (*newCtx->Driver.GetBufferSize)( readBuffer, &bufWidth, &bufHeight ); + + if (readBuffer->Width == bufWidth && readBuffer->Height == bufHeight) + return; /* size is as expected */ + + readBuffer->Width = bufWidth; + readBuffer->Height = bufHeight; + + newCtx->Driver.ResizeBuffers( readBuffer ); + } } /* This is only for T&L - a bit out of place, or misnamed (BP) */ |