diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-12-29 16:22:45 +0000 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2014-12-31 14:31:45 -0800 |
commit | fc9db89c53a2e6e65751bcd87337c74fa05de182 (patch) | |
tree | 8288e0f8bc68909e28310cfd33c8d5011d0f03cf | |
parent | b7f284f6a60b2a0d9d0e92045a08bbd75eb64b6c (diff) |
wgl: Verify the client area size matches the required size on window creation too.
By default, Windows will limit windows too large to theu desktop size,
and windows too small to be big enough for the titlebar. Waffle's
windows don't get affected as their style is WS_POPUPWINDOW, which
doesn't include the WS_CAPTION style.
This change adds more assertion, just in case this ever changes, as many
piglit tests rely on large/tiny windows to have the requested size.
Also replace `#ifdef DEBUG` with `#ifndef NDEBUG`, as NDEBUG is the
define that controls assert macro.
That said, I wonder if we should call
`waffle_errorf(WAFFLE_ERROR_INTERNAL, ...)` and verify this on release
builds too.
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
-rw-r--r-- | src/waffle/wgl/wgl_window.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/waffle/wgl/wgl_window.c b/src/waffle/wgl/wgl_window.c index a557c2f..7c3932f 100644 --- a/src/waffle/wgl/wgl_window.c +++ b/src/waffle/wgl/wgl_window.c @@ -127,6 +127,16 @@ wgl_window_priv_create(struct wcore_platform *wc_plat, if (!self->hWnd) goto error; +#ifndef NDEBUG + // Verify the client area size matches the required size. + + GetClientRect(self->hWnd, &rect); + assert(rect.left == 0); + assert(rect.top == 0); + assert(rect.right - rect.left == width); + assert(rect.bottom - rect.top == height); +#endif + self->hDC = GetDC(self->hWnd); if (!self->hDC) goto error; @@ -178,7 +188,7 @@ wgl_window_resize(struct wcore_window *wc_self, rect.bottom - rect.top, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); -#ifdef DEBUG +#ifndef NDEBUG // Verify the client area size matches the required size. GetClientRect(self->hWnd, &rect); |