Wayland: Use the primary monitor scale for windows on creation
This is needed because on creation the window may not have been assigned to any monitors, so we fallback to using the scale of the primary monitor. Fixes #2133. Fixes #2135
This commit is contained in:
parent
c4c6ef799f
commit
65fa7da24a
7
glfw/wl_window.c
vendored
7
glfw/wl_window.c
vendored
@ -55,13 +55,18 @@ static bool checkScaleChange(_GLFWwindow* window)
|
||||
if (_glfw.wl.compositorVersion < 3)
|
||||
return false;
|
||||
|
||||
// Get the scale factor from the highest scale monitor.
|
||||
// Get the scale factor from the highest scale monitor that this window is on
|
||||
for (i = 0; i < window->wl.monitorsCount; ++i)
|
||||
{
|
||||
monitorScale = window->wl.monitors[i]->wl.scale;
|
||||
if (scale < monitorScale)
|
||||
scale = monitorScale;
|
||||
}
|
||||
if (window->wl.monitorsCount < 1 && _glfw.monitorCount > 0) {
|
||||
// The window has not yet been assigned to any monitors, use the primary monitor
|
||||
_GLFWmonitor *m = _glfw.monitors[0];
|
||||
if (m && m->wl.scale > scale) scale = m->wl.scale;
|
||||
}
|
||||
|
||||
// Only change the framebuffer size if the scale changed.
|
||||
if (scale != window->wl.scale)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user