Fix window creation with Hi-DPI exiting under Wayland
Wayland requires the windows surface size is divisible by the surface scale. This wasn't guaranteed when creating new temporary windows. This meant opening the preferences could exit Blender with an error with Hi-DPI configurations.
This commit is contained in:
parent
1af62cb3bf
commit
fdcbad37be
Notes:
blender-bot
2023-02-14 10:37:49 +01:00
Referenced by issue #104343, Blender crashes on Wayland (SwayWM) if the window has non-default scaling enabled Referenced by issue #102967, 3.4: Potential candidates for corrective releases
|
@ -797,11 +797,6 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
|||
window_->ghost_window = this;
|
||||
window_->ghost_system = system;
|
||||
|
||||
window_->frame.size[0] = int32_t(width);
|
||||
window_->frame.size[1] = int32_t(height);
|
||||
|
||||
window_->is_dialog = is_dialog;
|
||||
|
||||
/* NOTE(@campbellbarton): The scale set here to avoid flickering on startup.
|
||||
* When all monitors use the same scale (which is quite common) there aren't any problems.
|
||||
*
|
||||
|
@ -813,6 +808,16 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
|||
* avoiding a large window flashing before it's made smaller. */
|
||||
window_->scale = outputs_max_scale_or_default(system_->outputs(), 1, &window_->scale_fractional);
|
||||
|
||||
window_->frame.size[0] = int32_t(width);
|
||||
window_->frame.size[1] = int32_t(height);
|
||||
|
||||
/* The window surface must be rounded to the scale,
|
||||
* failing to do so causes the WAYLAND-server to close the window immediately. */
|
||||
window_->frame.size[0] = (window_->frame.size[0] / window_->scale) * window_->scale;
|
||||
window_->frame.size[1] = (window_->frame.size[1] / window_->scale) * window_->scale;
|
||||
|
||||
window_->is_dialog = is_dialog;
|
||||
|
||||
/* Window surfaces. */
|
||||
window_->wl_surface = wl_compositor_create_surface(system_->wl_compositor());
|
||||
ghost_wl_surface_tag(window_->wl_surface);
|
||||
|
|
Loading…
Reference in New Issue