Fix invalid surface size under Wayland when GHOST set the window size

When the window manager set the window size, there were no checks
the size is a multiple of the buffer scale (a requirement for Wayland).

This meant setting the window size could exit Blender without warning
if an invalid window size was set.
This commit is contained in:
Campbell Barton
2023-10-18 14:37:09 +11:00
parent 46159c131d
commit 3ad21b2169

View File

@@ -1683,8 +1683,11 @@ GHOST_TSuccess GHOST_WindowWayland::setClientSize(const uint32_t width, const ui
std::lock_guard lock_frame_guard{window_->frame_pending_mutex};
#endif
window_->frame_pending.size[0] = width;
window_->frame_pending.size[1] = height;
GWL_WindowFrame &frame_pending = window_->frame_pending;
frame_pending.size[0] = width;
frame_pending.size[1] = height;
gwl_round_int2_by(frame_pending.size, frame_pending.buffer_scale);
gwl_window_frame_pending_size_set(window_, nullptr, nullptr, nullptr);