From 837703e585d026a109bcde9dc68f715d7f9dd0ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 9 May 2025 21:01:16 +1000 Subject: [PATCH] Fix: failure to start on Wayland/GNOME with monitors at different scales With two or more monitors of different scales, Blender would fail to start in some cases when it opened on a monitor at a size that wasn't a multiple of the monitors scale. This seemed only to cause problems with LIBDECOR however the buffer size should always be a multiple of the buffer scale, so ensure its always valid. See #135764 for details (a closely related bug). --- intern/ghost/intern/GHOST_WindowWayland.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowWayland.cc b/intern/ghost/intern/GHOST_WindowWayland.cc index a352cb52ef7..7eecbb029d4 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cc +++ b/intern/ghost/intern/GHOST_WindowWayland.cc @@ -2791,6 +2791,17 @@ bool GHOST_WindowWayland::outputs_changed_update_scale() /* Leave `window_->frame_pending` as-is, so changes are detected and updates are applied. */ do_frame_resize = false; do_frame_update = true; + + /* If the buffer scale changes, the window size (and underlying buffer-size) + * must always be a multiple of the buffer size. Resizing ensures this is the case. + * See replies to #135764 for details. + * + * NOTE: We could skip resize if the current window size is a multiple of the buffer scale, + * avoids this as it will result in unpredictable behavior based on single pixel differences + * in window size. */ + if (window_->frame_pending.buffer_scale != window_->frame.buffer_scale) { + do_frame_resize = true; + } } else { /* Test if the scale changed. */