Mesa (master): st/wgl: Prevent spurious framebuffer sizes when the window is minimized.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Tue Apr 12 04:04:49 PDT 2011


Module: Mesa
Branch: master
Commit: 16d42af618aa6250bedc7e66e0e2c0b061cc6e99
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=16d42af618aa6250bedc7e66e0e2c0b061cc6e99

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Apr  7 19:15:55 2011 +0100

st/wgl: Prevent spurious framebuffer sizes when the window is minimized.

When the window is minimized GetClientRect will return zeros.

Instead of creating a 1x1 framebuffer, simply preserve the current window
size, until the window is restored or maximized again.

---

 src/gallium/state_trackers/wgl/stw_framebuffer.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 670e542..d8b1440 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -112,7 +112,7 @@ stw_framebuffer_release(
 static INLINE void
 stw_framebuffer_get_size( struct stw_framebuffer *fb )
 {
-   unsigned width, height;
+   LONG width, height;
    RECT client_rect;
    RECT window_rect;
    POINT client_pos;
@@ -126,10 +126,17 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb )
    width = client_rect.right - client_rect.left;
    height = client_rect.bottom - client_rect.top;
 
-   if(width < 1)
-      width = 1;
-   if(height < 1)
-      height = 1;
+   if (width <= 0 || height <= 0) {
+      /*
+       * When the window is minimized GetClientRect will return zeros.  Simply
+       * preserve the current window size, until the window is restored or
+       * maximized again.
+       */
+
+      assert(width == 0 && height == 0);
+
+      return;
+   }
 
    if(width != fb->width || height != fb->height) {
       fb->must_resize = TRUE;



More information about the mesa-commit mailing list