summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-03-24 10:43:27 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-03-24 10:47:03 +0000
commitf4e392bf8d35a87f84c8a58f9d2bd174ec29ebd9 (patch)
tree407ab8710a66630507b25ddb2be1fe8743c01e05
parent81992010b57e5b137c9319b47f282e267a086582 (diff)
st/wgl: Adjust the pbuffer invisible window size.
Thanks to Brian Paul for diagnosing the issue.
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_pbuffer.c61
1 files changed, 53 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
index 32636c603dc..fb5d5e8b929 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
@@ -52,6 +52,9 @@ wglCreatePbufferARB(HDC _hDC,
int useLargest = 0;
const struct stw_pixelformat_info *info;
struct stw_framebuffer *fb;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ RECT rect;
HWND hWnd;
HDC hDC;
@@ -113,15 +116,45 @@ wglCreatePbufferARB(HDC _hDC,
first = FALSE;
}
- hWnd = CreateWindowEx(0,
+ dwExStyle = 0;
+ dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
+
+ if (0) {
+ /*
+ * Don't hide the window -- useful for debugging what the application is
+ * drawing
+ */
+
+ dwStyle |= WS_VISIBLE | WS_OVERLAPPEDWINDOW;
+ } else {
+ dwStyle |= WS_POPUPWINDOW;
+ }
+
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = rect.left + iWidth;
+ rect.bottom = rect.top + iHeight;
+
+ /*
+ * The CreateWindowEx parameters are the total (outside) dimensions of the
+ * window, which can vary with Windows version and user settings. Use
+ * AdjustWindowRect to get the required total area for the given client area.
+ *
+ * AdjustWindowRectEx does not accept WS_OVERLAPPED style (which is defined
+ * as 0), which means we need to use some other style instead, e.g.,
+ * WS_OVERLAPPEDWINDOW or WS_POPUPWINDOW as above.
+ */
+
+ AdjustWindowRectEx(&rect, dwStyle, FALSE, dwExStyle);
+
+ hWnd = CreateWindowEx(dwExStyle,
"wglpbuffer", /* wc.lpszClassName */
- "wglpbuffer",
-#if 0 /* Useful for debugging what the application is drawing */
- WS_VISIBLE |
-#endif
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, /* x, y */
- iWidth, iHeight,
+ NULL,
+ dwStyle,
+ CW_USEDEFAULT, /* x */
+ CW_USEDEFAULT, /* y */
+ rect.right - rect.left, /* width */
+ rect.bottom - rect.top, /* height */
NULL,
NULL,
NULL,
@@ -130,6 +163,18 @@ wglCreatePbufferARB(HDC _hDC,
return 0;
}
+#ifdef DEBUG
+ /*
+ * Verify the client area size matches the specified size.
+ */
+
+ GetClientRect(hWnd, &rect);
+ assert(rect.left == 0);
+ assert(rect.top == 0);
+ assert(rect.right - rect.left == iWidth);
+ assert(rect.bottom - rect.top == iHeight);
+#endif
+
hDC = GetDC(hWnd);
if (!hDC) {
return 0;