[PATCH] window: fix resizing of windows backed by shm buffers

Kristian Høgsberg krh at bitplanet.net
Fri Jan 27 08:25:19 PST 2012


On Fri, Jan 27, 2012 at 10:17 AM, Ander Conselvan de Oliveira
<ander.conselvan.de.oliveira at intel.com> wrote:
> When window_attach_surface() calls window_get_resize_dx_dy(),
> window->resize_edges is cleared. However if there is already a pending
> surface to be attached, the resize won't be done until the following
> call to window_attach_surface(). In this next call, since resize_edges
> is now zero, the top-left corner of the window will be unchanged. If
> the user is resizing from the top or left border, this causes the
> resize to happen in the wrong direction.
>
> This patch changes window_attach_surface() to call
> window_get_resize_dx_dy() only if an attach will actually happen.
>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> ---
> Maybe window_get_resize_dx_dy() should not be clearing resize_edges in
> the first place (since its just a get function and not actually doing
> the resize) but since I'm not that familiar with the window code in
> toytoolkit I opted for the easy fix.

Thanks.  It's the right fix, but we do need to clear the resize
displacement.  What happens is that window->server_allocation is the
most recent size we posted to the server, and we need to track that so
we can compute the displacement relative to the last size the server
saw.

Kristian

>  clients/window.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index 7ba6a22..97567db 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -832,8 +832,6 @@ window_attach_surface(struct window *window)
>        case WINDOW_BUFFER_TYPE_EGL_IMAGE:
>  #endif
>        case WINDOW_BUFFER_TYPE_SHM:
> -               window_get_resize_dx_dy(window, &x, &y);
> -
>                if (window->pending_surface != NULL)
>                        return;
>
> @@ -844,6 +842,7 @@ window_attach_surface(struct window *window)
>                        display_get_buffer_for_surface(display,
>                                                       window->pending_surface);
>
> +               window_get_resize_dx_dy(window, &x, &y);
>                wl_surface_attach(window->surface, buffer, x, y);
>                window->server_allocation = window->allocation;
>                cb = wl_display_sync(display->display);
> --
> 1.7.4.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list