Mesa (7.10): st/wgl: Adjust the pbuffer invisible window size.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Sun Jun 12 08:25:00 UTC 2011
Module: Mesa
Branch: 7.10
Commit: b6c601a5e8743b29b780b4de0d5738a5176a4092
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6c601a5e8743b29b780b4de0d5738a5176a4092
Author: José Fonseca <jfonseca at vmware.com>
Date: Thu Mar 24 10:43:27 2011 +0000
st/wgl: Adjust the pbuffer invisible window size.
Thanks to Brian Paul for diagnosing the issue.
---
src/gallium/state_trackers/wgl/stw_ext_pbuffer.c | 61 +++++++++++++++++++---
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 32636c6..fb5d5e8 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;
More information about the mesa-commit
mailing list