# SDL\_HideWindow and SDL\_ShowWindow under wayland

**URL:** <https://discourse.libsdl.org/t/sdl-hidewindow-and-sdl-showwindow-under-wayland/27371>\
**Category:** SDL Development\
**Created:** [March 22, 2020, 1:12pm UTC](https://discourse.libsdl.org/t/sdl-hidewindow-and-sdl-showwindow-under-wayland/27371 "2020-03-22T13:12:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yannd](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/y/e19adc/32.png) [@yannd](https://discourse.libsdl.org/u/yannd)\
**Post date:** [March 22, 2020, 1:12pm UTC](https://discourse.libsdl.org/t/sdl-hidewindow-and-sdl-showwindow-under-wayland/27371/1 "2020-03-22T13:12:28Z")

</div>

Here is a simple test app, creating a window and hiding it when key UP is pressed. It works as expected on Linux/X11, but on Linux/Wayland the window does not disappear. Checked on latest hg version too.

Similarly, a real-life app starting with the window hidden, and calling SDL\_ShowWindow() on a specific event will never show the window.

What can be the cause ? Is Wayland support complete yet ?

```auto
#include "SDL.h"
#include <stdio.h>

int main()
{
    SDL_Window *window = NULL;
    SDL_Renderer *renderer = NULL;
    SDL_bool error = SDL_TRUE;

    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        goto exit;
    }
    if (SDL_CreateWindowAndRenderer(640, 480, 0, &window, &renderer) < 0) {
        goto exit;
    }
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_DisableScreenSaver();

    while (SDL_TRUE) {
        SDL_Event event;
        while (SDL_PollEvent(&event)) {
            printf("event %d\n", event.type);
            switch (event.type) {
            case SDL_KEYUP:
                printf("key up\n");
                SDL_HideWindow(window);
                break;
            case SDL_MOUSEBUTTONUP:
            case SDL_QUIT:
                error = SDL_FALSE;
                goto exit;
            }
        }
        SDL_RenderClear(renderer);
        SDL_RenderPresent(renderer);
    }

exit:
    if (error) {
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError());
    }
    if (renderer) {
        SDL_DestroyRenderer(renderer);
    }
    if (window) {
        SDL_DestroyWindow(window);
    }
    SDL_Quit();
    return error;
}

```
