Hi,<br><br>I tested this patch briefly and it fixes the issue. A couple comments below.<br><br><div class="gmail_quote">On Thu, Feb 28, 2013 at 5:24 PM, MoD <span dir="ltr"><<a href="mailto:mod-oss@hush.ai" target="_blank">mod-oss@hush.ai</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Resolve a bad frame visible when maximizing toytoolkit programs with the the<br>
maximize button in decorations. Windows now use wl_display.sync requests to<br>
wait for a maximize to finish before drawing again, following suggestions from<br>
<a href="http://lists.freedesktop.org/archives/wayland-devel/2013-February/007650.html" target="_blank">http://lists.freedesktop.org/archives/wayland-devel/2013-February/007650.html</a><br>
---<br>
 clients/window.c | 43 +++++++++++++++++++++++++++++++++++++++++++<br>
 1 file changed, 43 insertions(+)<br>
<br>
diff --git a/clients/window.c b/clients/window.c<br>
index 249ba6f..16e9706 100644<br>
--- a/clients/window.c<br>
+++ b/clients/window.c<br>
@@ -223,6 +223,7 @@ struct window {<br>
<br>
        int resizing;<br>
        int fullscreen_method;<br>
+       int configure_requests;<br>
<br>
        window_key_handler_t key_handler;<br>
        window_keyboard_focus_handler_t keyboard_focus_handler;<br>
@@ -3375,6 +3376,8 @@ void<br>
 window_schedule_redraw(struct window *window)<br>
 {<br>
        window->redraw_needed = 1;<br>
+       if (window->configure_requests)<br>
+               return;<br>
        if (!window->redraw_scheduled) {<br>
                window->redraw_task.run = idle_redraw;<br>
                display_defer(window->display, &window->redraw_task);<br>
@@ -3388,6 +3391,43 @@ window_is_fullscreen(struct window *window)<br>
        return window->type == TYPE_FULLSCREEN;<br>
 }<br>
<br>
+static void<br>
+configure_request_completed(void *data, struct wl_callback *callback, uint32_t  time)<br>
+{<br>
+       struct window *window = data;<br>
+<br>
+       wl_callback_destroy(callback);<br>
+       window->configure_requests--;<br>
+<br>
+       if (!window->configure_requests)<br>
+               window_schedule_redraw(window);<br>
+}<br>
+<br>
+static struct wl_callback_listener configure_request_listener = {<br>
+       configure_request_completed,<br>
+};<br>
+<br>
+static void<br>
+window_anticipate_configure(struct window* window)<br></blockquote><div><br>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()?<br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+{<br>
+       struct wl_callback *callback;<br>
+<br>
+       if (window->redraw_scheduled)<br>
+       {<br></blockquote><div><br>The bracket should be on the same line as the if statement to maintain style consistency.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+               wl_list_remove(&window->redraw_task.link);<br>
+               window->redraw_scheduled = 0;<br>
+       }<br>
+       if (window->frame_cb)<br>
+       {<br></blockquote><div><br>Same here.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+               wl_callback_destroy(window->frame_cb);<br>
+               window->frame_cb = 0;<br>
+       }<br>
+<br>
+       callback = wl_display_sync(window->display->display);<br>
+       wl_callback_add_listener(callback, &configure_request_listener, window);<br>
+       window->configure_requests++;<br>
+}<br>
+<br>
 void<br>
 window_set_fullscreen(struct window *window, int fullscreen)<br>
 {<br>
@@ -3403,6 +3443,7 @@ window_set_fullscreen(struct window *window, int fullscreen)<br>
                wl_shell_surface_set_fullscreen(window->shell_surface,<br>
                                                window->fullscreen_method,<br>
                                                0, NULL);<br>
+               window_anticipate_configure (window);<br>
        } else {<br>
                window->type = TYPE_TOPLEVEL;<br>
                wl_shell_surface_set_toplevel(window->shell_surface);<br>
@@ -3438,6 +3479,7 @@ window_set_maximized(struct window *window, int maximized)<br>
                window->saved_allocation = window->main_surface->allocation;<br>
                wl_shell_surface_set_maximized(window->shell_surface, NULL);<br>
                window->type = TYPE_MAXIMIZED;<br>
+               window_anticipate_configure (window);<br>
        } else {<br>
                wl_shell_surface_set_toplevel(window->shell_surface);<br>
                window->type = TYPE_TOPLEVEL;<br>
@@ -3646,6 +3688,7 @@ window_create_internal(struct display *display,<br>
<br>
        window->type = type;<br>
        window->fullscreen_method = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;<br>
+       window->configure_requests = 0;<br>
<br>
        if (display->argb_device)<br>
 #ifdef HAVE_CAIRO_EGL<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br><br></font></span></blockquote><div><br>- Scott <br></div></div><br>