diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 32ae40f80c..c513613e3a 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -657,8 +657,11 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, wl->width = width; wl->height = height; } - - wl_egl_window_resize(wl->win, width, height, 0, 0); + + if (wl->win) + wl_egl_window_resize(wl->win, width, height, 0, 0); + else + wl->win = wl_egl_window_create(wl->surface, wl->width * wl->buffer_scale, wl->height * wl->buffer_scale); wl->configured = false; } @@ -724,7 +727,10 @@ static void handle_zxdg_toplevel_config(void *data, struct zxdg_toplevel_v6 *top wl->height = height; } - wl_egl_window_resize(wl->win, width, height, 0, 0); + if (wl->win) + wl_egl_window_resize(wl->win, width, height, 0, 0); + else + wl->win = wl_egl_window_create(wl->surface, wl->width * wl->buffer_scale, wl->height * wl->buffer_scale); wl->configured = false; }