[PATCH weston v2] toytoolkit: avoid redrawing a window between maximize and configure
Scott Moreau
oreaus at gmail.com
Thu Feb 28 20:18:26 PST 2013
Hi,
I tested this patch briefly and it fixes the issue. A couple comments below.
On Thu, Feb 28, 2013 at 5:24 PM, MoD <mod-oss at hush.ai> wrote:
> Resolve a bad frame visible when maximizing toytoolkit programs with the
> the
> maximize button in decorations. Windows now use wl_display.sync requests to
> wait for a maximize to finish before drawing again, following suggestions
> from
>
> http://lists.freedesktop.org/archives/wayland-devel/2013-February/007650.html
> ---
> clients/window.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/clients/window.c b/clients/window.c
> index 249ba6f..16e9706 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -223,6 +223,7 @@ struct window {
>
> int resizing;
> int fullscreen_method;
> + int configure_requests;
>
> window_key_handler_t key_handler;
> window_keyboard_focus_handler_t keyboard_focus_handler;
> @@ -3375,6 +3376,8 @@ void
> window_schedule_redraw(struct window *window)
> {
> window->redraw_needed = 1;
> + if (window->configure_requests)
> + return;
> if (!window->redraw_scheduled) {
> window->redraw_task.run = idle_redraw;
> display_defer(window->display, &window->redraw_task);
> @@ -3388,6 +3391,43 @@ window_is_fullscreen(struct window *window)
> return window->type == TYPE_FULLSCREEN;
> }
>
> +static void
> +configure_request_completed(void *data, struct wl_callback *callback,
> uint32_t time)
> +{
> + struct window *window = data;
> +
> + wl_callback_destroy(callback);
> + window->configure_requests--;
> +
> + if (!window->configure_requests)
> + window_schedule_redraw(window);
> +}
> +
> +static struct wl_callback_listener configure_request_listener = {
> + configure_request_completed,
> +};
> +
> +static void
> +window_anticipate_configure(struct window* window)
>
I'm not sure I like the word anticipate in a function, it sounds hackish
for some reason. Maybe something like window_redraw_deferred() or
window_defer_redraw()?
> +{
> + struct wl_callback *callback;
> +
> + if (window->redraw_scheduled)
> + {
>
The bracket should be on the same line as the if statement to maintain
style consistency.
> + wl_list_remove(&window->redraw_task.link);
> + window->redraw_scheduled = 0;
> + }
> + if (window->frame_cb)
> + {
>
Same here.
> + wl_callback_destroy(window->frame_cb);
> + window->frame_cb = 0;
> + }
> +
> + callback = wl_display_sync(window->display->display);
> + wl_callback_add_listener(callback, &configure_request_listener,
> window);
> + window->configure_requests++;
> +}
> +
> void
> window_set_fullscreen(struct window *window, int fullscreen)
> {
> @@ -3403,6 +3443,7 @@ window_set_fullscreen(struct window *window, int
> fullscreen)
> wl_shell_surface_set_fullscreen(window->shell_surface,
> window->fullscreen_method,
> 0, NULL);
> + window_anticipate_configure (window);
> } else {
> window->type = TYPE_TOPLEVEL;
> wl_shell_surface_set_toplevel(window->shell_surface);
> @@ -3438,6 +3479,7 @@ window_set_maximized(struct window *window, int
> maximized)
> window->saved_allocation =
> window->main_surface->allocation;
> wl_shell_surface_set_maximized(window->shell_surface,
> NULL);
> window->type = TYPE_MAXIMIZED;
> + window_anticipate_configure (window);
> } else {
> wl_shell_surface_set_toplevel(window->shell_surface);
> window->type = TYPE_TOPLEVEL;
> @@ -3646,6 +3688,7 @@ window_create_internal(struct display *display,
>
> window->type = type;
> window->fullscreen_method =
> WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
> + window->configure_requests = 0;
>
> if (display->argb_device)
> #ifdef HAVE_CAIRO_EGL
> --
> 1.8.1.4
>
>
- Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130228/09a1c848/attachment-0001.html>
More information about the wayland-devel
mailing list