Browse Source

release exclusive mode when window is closed

David Rose 23 years ago
parent
commit
2ceb53166f
1 changed files with 13 additions and 4 deletions
  1. 13 4
      panda/src/dxgsg7/wdxGraphicsWindow7.cxx

+ 13 - 4
panda/src/dxgsg7/wdxGraphicsWindow7.cxx

@@ -167,6 +167,15 @@ make_gsg() {
 void wdxGraphicsWindow7::
 void wdxGraphicsWindow7::
 release_gsg() {
 release_gsg() {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
   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();
     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");
     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);
     hr = pDD->CreateSurface(&ddsd, &pPrimaryDDSurf, NULL);
     if (FAILED(hr)) {
     if (FAILED(hr)) {
       wdxdisplay7_cat.fatal()
       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");
     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);
     hr = pDD->CreateSurface(&SurfaceDesc, &pPrimaryDDSurf, NULL);
     if (FAILED(hr)) {
     if (FAILED(hr)) {
       wdxdisplay7_cat.fatal()
       wdxdisplay7_cat.fatal()
@@ -1216,7 +1225,7 @@ set_coop_levels_and_display_modes() {
   }
   }
 
 
   DXScreenData *pScrn = &_dxgsg->scrn;
   DXScreenData *pScrn = &_dxgsg->scrn;
-  
+
   if (!is_fullscreen()) {
   if (!is_fullscreen()) {
     hr = pScrn->pDD->SetCooperativeLevel(_mwindow, 
     hr = pScrn->pDD->SetCooperativeLevel(_mwindow, 
                                          SCL_FPUFlag | DDSCL_NORMAL);
                                          SCL_FPUFlag | DDSCL_NORMAL);