From 2ceb53166faf639e96a237b5ec79f902f764ee4b Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 26 Feb 2003 00:15:18 +0000 Subject: [PATCH] release exclusive mode when window is closed --- panda/src/dxgsg7/wdxGraphicsWindow7.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/panda/src/dxgsg7/wdxGraphicsWindow7.cxx b/panda/src/dxgsg7/wdxGraphicsWindow7.cxx index af52013715..12a199bd2e 100644 --- a/panda/src/dxgsg7/wdxGraphicsWindow7.cxx +++ b/panda/src/dxgsg7/wdxGraphicsWindow7.cxx @@ -167,6 +167,15 @@ make_gsg() { void wdxGraphicsWindow7:: release_gsg() { if (_gsg != (GraphicsStateGuardian *)NULL) { + + if (is_fullscreen()) { + // Release the cooperative level we grabbed when we created the + // GSG. + DXScreenData *pScrn = &_dxgsg->scrn; + nassertv(pScrn != (DXScreenData *)NULL); + pScrn->pDD->SetCooperativeLevel(_mwindow, DDSCL_NORMAL); + } + GraphicsWindow::release_gsg(); } } @@ -498,7 +507,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer PRINTVIDMEM(pDD, &ddsd.ddsCaps, "initial primary & backbuf"); - // Create the primary surface + // Create the primary surface for the fullscreen window hr = pDD->CreateSurface(&ddsd, &pPrimaryDDSurf, NULL); if (FAILED(hr)) { wdxdisplay7_cat.fatal() @@ -619,8 +628,8 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer PRINTVIDMEM(pDD, &SurfaceDesc.ddsCaps, "initial primary surface"); - // Create the primary surface. This includes all of the visible - // window, so no need to specify height/width + // Create the primary surface for windowed mode. This includes + // all of the visible window, so no need to specify height/width. hr = pDD->CreateSurface(&SurfaceDesc, &pPrimaryDDSurf, NULL); if (FAILED(hr)) { wdxdisplay7_cat.fatal() @@ -1216,7 +1225,7 @@ set_coop_levels_and_display_modes() { } DXScreenData *pScrn = &_dxgsg->scrn; - + if (!is_fullscreen()) { hr = pScrn->pDD->SetCooperativeLevel(_mwindow, SCL_FPUFlag | DDSCL_NORMAL);