Hide surface

ferreiradaselva ferreiradaselva at protonmail.com
Sun Nov 26 20:23:52 UTC 2017


Hi,

My first time posting here (sorry if I'm posting on the wrong place).

I'm working on this window creation framework (https://github.com/ferreiradaselva/swfw), and for the Wayland backend I need to implement a function to hide the "window".

I found that that is done by destroying the surface (I'm assuming the wl_shell_surface). This is currently how I'm trying to do:

=============================
void swfw_hide_window_wl(struct swfw_window_wl *swfw_win_wl)
{
    if (swfw_win_wl->shell_surface) {
        wl_shell_surface_destroy(swfw_win_wl->shell_surface);
        swfw_win_wl->shell_surface = NULL;
        wl_surface_commit(swfw_win_wl->surface);
    }
}

void swfw_show_window_wl(struct swfw_window_wl *swfw_win_wl)
{
    if (!swfw_win_wl->shell_surface) {
        swfw_win_wl->shell_surface = wl_shell_get_shell_surface(swfw_win_wl->swfw_ctx_wl->shell, swfw_win_wl->surface);
        wl_shell_surface_add_listener(swfw_win_wl->shell_surface, &shell_surface_listener, swfw_win_wl);
        wl_shell_surface_set_toplevel(swfw_win_wl->shell_surface);
        wl_surface_commit(swfw_win_wl->surface);
    }
}
=============================

However, even after destroying the shell surface, the surface is still rendered (testing on weston). Calling the function to show the surface again will result in the surface being rendered twice on the screen. I'm also using EGL, if that matters somehow.

I couldn't find any example on internet on how to properly hide the surface (I couldn't get working with GLFW, and SDL doesn't seem to implement the hide function on wayland).

-- Felipe Ferreira

Sent with [ProtonMail](https://protonmail.com) Secure Email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20171126/db888278/attachment.html>


More information about the wayland-devel mailing list