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).
This commit is contained in:
Campbell Barton
2025-05-09 21:01:16 +10:00
parent 4acd6d46d4
commit 837703e585

View File

@@ -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. */