[PATCH weston v1 06/17] clients: add window_get_decoration_size
Pekka Paalanen
ppaalanen at gmail.com
Fri Dec 12 06:27:08 PST 2014
On Fri, 5 Dec 2014 14:36:39 +0100
Marek Chalupa <mchqwerty at gmail.com> wrote:
> In tests we need to know about the decoration size. Moreover
> it's a small clean-up.
>
> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> ---
> clients/window.c | 37 ++++++++++++++++++++++---------------
> clients/window.h | 2 ++
> 2 files changed, 24 insertions(+), 15 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index 8dbf878..7ac2b8f 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -2524,26 +2524,33 @@ window_frame_create(struct window *window, void *data)
> }
>
> void
> -window_frame_set_child_size(struct widget *widget, int child_width,
> - int child_height)
> +window_get_decoration_size(struct window *window, int *width, int *height)
> {
> - struct display *display = widget->window->display;
> + struct display *display = window->display;
> struct theme *t = display->theme;
> + int margin;
> +
> + if (window->maximized || window->fullscreen)
> + margin = 0;
> + else
> + margin = t->margin;
> +
> + if (width)
> + *width = (t->width + margin) * 2;
> + if (height)
> + *height = t->width + t->titlebar_height + margin * 2;
> +}
> +
> +void
> +window_frame_set_child_size(struct widget *widget, int width, int height)
> +{
> int decoration_width, decoration_height;
> - int width, height;
> - int margin = widget->window->maximized ? 0 : t->margin;
>
> - if (!widget->window->fullscreen) {
> - decoration_width = (t->width + margin) * 2;
> - decoration_height = t->width +
> - t->titlebar_height + margin * 2;
> + window_get_decoration_size(widget->window, &decoration_width,
> + &decoration_height);
>
> - width = child_width + decoration_width;
> - height = child_height + decoration_height;
> - } else {
> - width = child_width;
> - height = child_height;
If window->fullscreen is true, I think the new code does not match the
old code. The theme parameters are not rewritten somewhere else
according to fullscreen, are they?
Thanks,
pq
> - }
> + width += decoration_width;
> + height += decoration_height;
>
> window_schedule_resize(widget->window, width, height);
> }
> diff --git a/clients/window.h b/clients/window.h
> index 20d3fa0..a6675d0 100644
> --- a/clients/window.h
> +++ b/clients/window.h
> @@ -349,6 +349,8 @@ void
> window_schedule_redraw(struct window *window);
> void
> window_schedule_resize(struct window *window, int width, int height);
> +void
> +window_get_decoration_size(struct window *window, int *height, int *width);
>
> void
> window_damage(struct window *window, int32_t x, int32_t y,
More information about the wayland-devel
mailing list