From 2df59062dcd52217231d1d6ec1f9a6d176ca7dd7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 15 Apr 2018 17:42:09 -0400 Subject: [PATCH] wayland: zxdg_shell_v6 needs a configure event before using a surface at all. Fixes Bugzilla #4109. Fixes Bugzilla #4119. --- src/video/wayland/SDL_waylandwindow.c | 14 ++++++++++++++ src/video/wayland/SDL_waylandwindow.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 684022a791418..46d0046effb0e 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -113,6 +113,9 @@ handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, ui SDL_WindowData *wind = (SDL_WindowData *)data; SDL_Window *window = wind->sdlwindow; struct wl_region *region; + + wind->shell_surface.zxdg.initial_configure_seen = SDL_TRUE; + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); region = wl_compositor_create_region(wind->waylandData->compositor); @@ -477,6 +480,17 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) wl_surface_commit(data->surface); WAYLAND_wl_display_flush(c->display); + /* we have to wait until the surface gets a "configure" event, or + use of this surface will fail. This is a new rule for xdg_shell. */ + if (c->shell.zxdg) { + if (data->shell_surface.zxdg.surface) { + while (!data->shell_surface.zxdg.initial_configure_seen) { + WAYLAND_wl_display_flush(c->display); + WAYLAND_wl_display_dispatch(c->display); + } + } + } + return 0; } diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index 80d4f3138edd0..fa56c764dd6b0 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -37,6 +37,7 @@ typedef struct { struct zxdg_toplevel_v6 *toplevel; struct zxdg_popup_v6 *popup; } roleobj; + SDL_bool initial_configure_seen; } SDL_zxdg_shell_surface; typedef struct {