<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 14, 2014 at 2:45 AM, Giulio Camuffo <span dir="ltr"><<a href="mailto:giuliocamuffo@gmail.com" target="_blank">giuliocamuffo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2014-10-13 4:57 GMT+03:00 Jasper St. Pierre <<a href="mailto:jstpierre@mecheye.net">jstpierre@mecheye.net</a>>:<br>
<span class="">> Committing to an xdg_surface with a NULL buffer is currently illegal in<br>
> the mutter implementation, so this simply causes the client to error and<br>
> exit.<br>
<br>
</span>The patch looks good to me.<br>
However, this leaves me wondering how does a client hide a surface.<br>
Does it have to destroy the xdg_surface? I'd expect a compositor to<br>
show a window at the same position it was when hidden, but destroying<br>
the xdg_surface loses all the state<br></blockquote><div><br></div><div>When combined with map / unmap animations, I think we have to decide that "show" means "the window is presented in a compositor-chosen place". As such, I chose to make attaching a NULL buffer against the rules.<br><br></div><div>Are there any use cases for hiding a window while keeping it in the same place? We couldn't think of any on IRC.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
--<br>
Giulio<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> It seems the reason the client did this was so it could add its own<br>
> frame callback, but toytoolkit actually provides accurate everything we<br>
> need. Just use its functions instead to get the time and schedule a<br>
> redraw.<br>
> ---<br>
>  clients/smoke.c | 24 ++----------------------<br>
>  1 file changed, 2 insertions(+), 22 deletions(-)<br>
><br>
> diff --git a/clients/smoke.c b/clients/smoke.c<br>
> index 65b6e03..7f0d5e5 100644<br>
> --- a/clients/smoke.c<br>
> +++ b/clients/smoke.c<br>
> @@ -39,7 +39,6 @@ struct smoke {<br>
>         struct widget *widget;<br>
>         int width, height;<br>
>         int current;<br>
> -       uint32_t time;<br>
>         struct { float *d, *u, *v; } b[2];<br>
>  };<br>
><br>
> @@ -171,27 +170,10 @@ static void render(struct smoke *smoke, cairo_surface_t *surface)<br>
>  }<br>
><br>
>  static void<br>
> -frame_callback(void *data, struct wl_callback *callback, uint32_t time)<br>
> -{<br>
> -       struct smoke *smoke = data;<br>
> -<br>
> -       window_schedule_redraw(smoke->window);<br>
> -       smoke->time = time;<br>
> -<br>
> -       if (callback)<br>
> -               wl_callback_destroy(callback);<br>
> -}<br>
> -<br>
> -static const struct wl_callback_listener listener = {<br>
> -       frame_callback,<br>
> -};<br>
> -<br>
> -static void<br>
>  redraw_handler(struct widget *widget, void *data)<br>
>  {<br>
>         struct smoke *smoke = data;<br>
> -       uint32_t time = smoke->time;<br>
> -       struct wl_callback *callback;<br>
> +       uint32_t time = widget_get_last_time(smoke->widget);<br>
>         cairo_surface_t *surface;<br>
><br>
>         diffuse(smoke, time / 30, smoke->b[0].u, smoke->b[1].u);<br>
> @@ -222,9 +204,7 @@ redraw_handler(struct widget *widget, void *data)<br>
><br>
>         cairo_surface_destroy(surface);<br>
><br>
> -       callback = wl_surface_frame(window_get_wl_surface(smoke->window));<br>
> -       wl_callback_add_listener(callback, &listener, smoke);<br>
> -       wl_surface_commit(window_get_wl_surface(smoke->window));<br>
> +       widget_schedule_redraw(smoke->widget);<br>
>  }<br>
><br>
>  static void<br>
> --<br>
> 2.1.0<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Jasper<br>
</div></div>