From 8836d41542920cb2d37930abac35bda2bb779b61 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 May 2025 12:11:40 +0000 Subject: [PATCH] Fix #135764: Crash on startup with mutli-monitors on Gnome Wayland Rotated outputs caused a workaround for a bug in GNOME to fail. Also check the native size since the `size_logical` would always be set to match the `size_native`. --- intern/ghost/intern/GHOST_SystemWayland.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWayland.cc b/intern/ghost/intern/GHOST_SystemWayland.cc index 9ee1440a2dc..931ad269ecb 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cc +++ b/intern/ghost/intern/GHOST_SystemWayland.cc @@ -6257,7 +6257,7 @@ static void xdg_output_handle_logical_size(void *data, CLOG_INFO(LOG, 2, "logical_size [%d, %d]", width, height); GWL_Output *output = static_cast(data); - if (output->size_logical[0] != 0 && output->size_logical[1] != 0) { + if (output->size_native[0] != 0 && output->size_native[1] != 0) { /* Original comment from SDL. */ /* FIXME(@flibit): GNOME has a bug where the logical size does not account for * scale, resulting in bogus viewport sizes. @@ -6265,9 +6265,8 @@ static void xdg_output_handle_logical_size(void *data, * Until this is fixed, validate that _some_ kind of scaling is being * done (we can't match exactly because fractional scaling can't be * detected otherwise), then override if necessary. */ - if ((output->size_logical[0] == width) && - (output->scale_fractional == (1 * FRACTIONAL_DENOMINATOR))) - { + int width_native = output->size_native[(output->transform & WL_OUTPUT_TRANSFORM_90) ? 1 : 0]; + if ((width_native == width) && (output->scale_fractional == (1 * FRACTIONAL_DENOMINATOR))) { GHOST_PRINT("xdg_output scale did not match, overriding with wl_output scale\n"); #ifdef USE_GNOME_CONFINE_HACK