[waffle] [PATCH 3/3] wgl: Verify the client area size matches the required size on window creation too.
Emil Velikov
emil.l.velikov at gmail.com
Mon Dec 29 14:01:32 PST 2014
On 29/12/14 16:22, Jose Fonseca wrote:
> From: José Fonseca <jfonseca at vmware.com>
>
> 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 is one of the hacks that I've added in waffle (please be gentle),
which I want to cleanup as waffle_window_create2 lands. My rough idea is
to feed WS_POPUPWINDOW on -auto piglits and WS_CAPTION otherwise into
waffle_window_create2. The principle is analogous to the "don't capture
input" approach as seen with glx.
Afaict the idea of waffle is to avoid nasty things/assumptions when
possible and the above idea should help.
How does it sound ?
> 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.
Barring a bug somewhere I don't think it will ever get hit. And as/if we
go with waffle_create_window2, as mentioned above, the asserts/error
will be out of place.
With the day-dreaming aside the series looks great imho.
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> src/waffle/wgl/wgl_window.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> 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);
>
More information about the waffle
mailing list