st/wgl: fix issue with SwapBuffers of minimized windows
authorBrian Paul <brianp@vmware.com>
Wed, 17 Apr 2013 22:16:24 +0000 (16:16 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 17 Apr 2013 22:23:19 +0000 (16:23 -0600)
If a window's minimized we get a zero-size window.  Skip the SwapBuffers
in that case to avoid some warning messages with the VMware svga driver.
Internal bug #996695

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/state_trackers/wgl/stw_framebuffer.c
src/gallium/state_trackers/wgl/stw_framebuffer.h

index c22e0f153f091157b51060a907439e9f3353420d..18ecb05e94f198a581771bf7e04768f97db0642b 100644 (file)
@@ -140,6 +140,8 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb )
    width  = client_rect.right  - client_rect.left;
    height = client_rect.bottom - client_rect.top;
 
+   fb->minimized = width == 0 || height == 0;
+
    if (width <= 0 || height <= 0) {
       /*
        * When the window is minimized GetClientRect will return zeros.  Simply
@@ -530,15 +532,17 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
       }
    }
 
-   if(fb->shared_surface) {
-      stw_dev->stw_winsys->compose(screen,
-                                   res,
-                                   fb->shared_surface,
-                                   &fb->client_rect,
-                                   data->PresentHistoryToken);
-   }
-   else {
-      stw_dev->stw_winsys->present( screen, res, hdc );
+   if (!fb->minimized) {
+      if (fb->shared_surface) {
+         stw_dev->stw_winsys->compose(screen,
+                                      res,
+                                      fb->shared_surface,
+                                      &fb->client_rect,
+                                      data->PresentHistoryToken);
+      }
+      else {
+         stw_dev->stw_winsys->present( screen, res, hdc );
+      }
    }
 
    stw_framebuffer_update(fb);
index 3ba51ba6898b18e02983e05d1cfff38aab970873..cee28e8a19a1cec0d9bd9b655d861a01a13ebd15 100644 (file)
@@ -79,6 +79,8 @@ struct stw_framebuffer
    /* FIXME: Make this work for multiple contexts bound to the same framebuffer */
    boolean must_resize;
 
+   boolean minimized;  /**< Is the window currently minimized? */
+
    unsigned width;
    unsigned height;