Commit fc9db89c authored by Jose Fonseca's avatar Jose Fonseca Committed by Chad Versace

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's avatarEmil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: default avatarChad Versace <chad.versace@intel.com>
parent b7f284f6
...@@ -127,6 +127,16 @@ wgl_window_priv_create(struct wcore_platform *wc_plat, ...@@ -127,6 +127,16 @@ wgl_window_priv_create(struct wcore_platform *wc_plat,
if (!self->hWnd) if (!self->hWnd)
goto error; 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); self->hDC = GetDC(self->hWnd);
if (!self->hDC) if (!self->hDC)
goto error; goto error;
...@@ -178,7 +188,7 @@ wgl_window_resize(struct wcore_window *wc_self, ...@@ -178,7 +188,7 @@ wgl_window_resize(struct wcore_window *wc_self,
rect.bottom - rect.top, rect.bottom - rect.top,
SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
#ifdef DEBUG #ifndef NDEBUG
// Verify the client area size matches the required size. // Verify the client area size matches the required size.
GetClientRect(self->hWnd, &rect); GetClientRect(self->hWnd, &rect);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment