summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-04-07 19:15:55 +0100
committerJosé Fonseca <jose.r.fonseca@gmail.com>2011-06-12 09:15:45 +0100
commitac28843c1ad9cf8aaa57218c2bf3bbe56804df6b (patch)
tree9e52d08470a708fd8b45d2fd559088a2314219be /src
parentc78ac563f11272a20954c1ad0210df4cafcc12d4 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c17
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 670e542cb4f..d8b1440a688 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;