From 4ea21a97c345e29dd7ccb1179c8b0c9f3eaf8ed8 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Wed, 17 Sep 2025 00:33:32 +0100 Subject: [PATCH] wayland: Don't try to guess the display size --- gfx/common/wayland_common.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gfx/common/wayland_common.c b/gfx/common/wayland_common.c index 59bba26e824f..ff567986b8f0 100644 --- a/gfx/common/wayland_common.c +++ b/gfx/common/wayland_common.c @@ -247,16 +247,13 @@ void gfx_ctx_wl_get_video_size_common(void *data, wl->reported_display_size = true; - /* If window is not ready get any monitor */ - if (!oi) - wl_list_for_each(od, &wl->all_outputs, link) - { - oi = od->output; - break; - }; - - *width = oi->width; - *height = oi->height; + /* We won't know which monitor we're targeting until the surface enters it. + * This only happens once we've attached a buffer to it. */ + if (oi) + { + *width = oi->width; + *height = oi->height; + } } else {