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`.
This commit is contained in:
Campbell Barton
2025-05-08 12:11:40 +00:00
parent f7dc522834
commit 8836d41542

View File

@@ -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<GWL_Output *>(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