From 91e06fff2d6f15b9d69838e513b9025985f58b57 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Tue, 1 Dec 2020 16:40:33 -0700 Subject: wayland: Fix initial black screen due to size of 0x0 https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/stable/xdg-shell/xdg-shell.xml#L1037 states regarding xdg_toplevel.configure "The width and height arguments specify a hint to the window". imv was using these dimensions even if they are 0x0, which is valid for the compositor to send. Clearly this is a bad hint and should be ignored. This patch does that, and fixes #293. --- src/wl_window.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/wl_window.c b/src/wl_window.c index 17ea976..d79f1bb 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -610,8 +610,11 @@ static void toplevel_configure(void *data, struct xdg_toplevel *toplevel, (void)toplevel; struct imv_window *window = data; - window->width = width; - window->height = height; + + if (width > 0 && height > 0) { + window->width = width; + window->height = height; + } window->fullscreen = false; enum xdg_toplevel_state *state; @@ -629,10 +632,10 @@ static void toplevel_configure(void *data, struct xdg_toplevel *toplevel, .type = IMV_EVENT_RESIZE, .data = { .resize = { - .width = width, - .height = height, - .buffer_width = width * window->scale, - .buffer_height = height * window->scale + .width = window->width, + .height = window->height, + .buffer_width = window->width * window->scale, + .buffer_height = window->height * window->scale } } }; @@ -713,6 +716,9 @@ static void create_window(struct imv_window *window, int width, int height, window->egl_surface = eglCreateWindowSurface(window->egl_display, config, window->egl_window, NULL); eglMakeCurrent(window->egl_display, window->egl_surface, window->egl_surface, window->egl_context); + window->width = width; + window->height = height; + wl_surface_commit(window->wl_surface); wl_display_roundtrip(window->wl_display); } -- cgit v1.2.3