<div>Hi, Matt<br></div><div><br></div><div>Thank you very much for the response! Removing the buffer (passing NULL with `wl_surface_attach`) worked. The function wl_shell_surface_minimize seems to not exist in the headers that I included (wayland-client.h and wayland-server.h), so I couldn't try that option.<br></div><div><br></div><div>I'm now trying to show the surface again. I think I found how in the documentation: attaching a new buffer created by a wl_shm_pool. So I'm going to try that.<br></div><div><br></div><div>Thanks for the help!<br></div><div>-- Felipe Ferreira<br></div><div><br></div><div class="protonmail_signature_block"><div class="protonmail_signature_block-user protonmail_signature_block-empty"><br></div><div class="protonmail_signature_block-proton">Sent with <a href="https://protonmail.com">ProtonMail</a> Secure Email.<br></div></div><div><br></div><blockquote class="protonmail_quote" type="cite"><div>-------- Original Message --------<br></div><div>Subject: Re: Hide surface<br></div><div>Local Time: November 27, 2017 3:48 PM<br></div><div>UTC Time: November 27, 2017 6:48 PM<br></div><div>From: matt.hoosier@gmail.com<br></div><div>To: ferreiradaselva <ferreiradaselva@protonmail.com><br></div><div>wayland-devel@lists.freedesktop.org <wayland-devel@lists.freedesktop.org><br></div><div><br></div><div><div>On Sun, Nov 26, 2017 at 2:23 PM, ferreiradaselva<br></div><div><a href="mailto:ferreiradaselva@protonmail.com">ferreiradaselva@protonmail.com</a> wrote:<br></div></div><blockquote><div>Hi,<br></div><div><div>My first time posting here (sorry if I'm posting on the wrong place).<br></div><div><br></div><div>You're in the right place. Welcome!<br></div></div><div><div>I'm working on this window creation framework<br></div><div>(<a href="https://github.com/ferreiradaselva/swfw">https://github.com/ferreiradaselva/swfw</a>), and for the Wayland backend I<br></div><div>need to implement a function to hide the "window".<br></div></div><div><div>I found that that is done by destroying the surface (I'm assuming the<br></div><div>wl_shell_surface). This is currently how I'm trying to do:<br></div></div><div><div>=============================<br></div><div>void swfw_hide_window_wl(struct swfw_window_wl *swfw_win_wl)<br></div><div>{<br></div><div>if (swfw_win_wl->shell_surface) {<br></div><div>wl_shell_surface_destroy(swfw_win_wl->shell_surface);<br></div><div>swfw_win_wl->shell_surface = NULL;<br></div><div>wl_surface_commit(swfw_win_wl->surface);<br></div><div>}<br></div><div>}<br></div></div><h1><div>void swfw_show_window_wl(struct swfw_window_wl *swfw_win_wl)<br></div><div>{<br></div><div>if (!swfw_win_wl->shell_surface) {<br></div><div>swfw_win_wl->shell_surface =<br></div><div>wl_shell_get_shell_surface(swfw_win_wl->swfw_ctx_wl->shell,<br></div><div>swfw_win_wl->surface);<br></div><div>wl_shell_surface_add_listener(swfw_win_wl->shell_surface,<br></div><div>&shell_surface_listener, swfw_win_wl);<br></div><div>wl_shell_surface_set_toplevel(swfw_win_wl->shell_surface);<br></div><div>wl_surface_commit(swfw_win_wl->surface);<br></div><div>}<br></div><div>}<br></div></h1><div><div>However, even after destroying the shell surface, the surface is still<br></div><div>rendered (testing on weston). Calling the function to show the surface again<br></div><div>will result in the surface being rendered twice on the screen. I'm also<br></div><div>using EGL, if that matters somehow.<br></div></div><div><div>I couldn't find any example on internet on how to properly hide the surface<br></div><div>(I couldn't get working with GLFW, and SDL doesn't seem to implement the<br></div><div>hide function on wayland).<br></div><div><br></div><div>There are a couple levels of abstraction you might choose to approach<br></div><div>your need from. If you're always going to be using wl-shell, then you<br></div><div>can minimize the window. Have a look at wl_shell_surface::minimize.<br></div><div>Depending on the desktop environment, that may be the behavior you<br></div><div>were most closely seeking anyway.<br></div><div><br></div><div>If you simply want the application-defined window content to<br></div><div>disappear, however, then just attach a null buffer to the wl_surface.<br></div><div>That is, wl_surface::attach( NULL ). Upon the next<br></div><div>wl_surface::commit(), the prior renderbuffers will no longer get<br></div><div>painted into the composited scene.<br></div></div></blockquote></blockquote><div><br></div>