|
|
@ -345,26 +345,25 @@ static void resizeWindow(_GLFWwindow* window) |
|
|
|
|
|
|
|
|
|
|
|
static void checkScaleChange(_GLFWwindow* window) |
|
|
|
static void checkScaleChange(_GLFWwindow* window) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int scale = 1; |
|
|
|
|
|
|
|
int monitorScale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if we will be able to set the buffer scale or not.
|
|
|
|
// Check if we will be able to set the buffer scale or not.
|
|
|
|
if (_glfw.wl.compositorVersion < 3) |
|
|
|
if (_glfw.wl.compositorVersion < 3) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Get the scale factor from the highest scale monitor.
|
|
|
|
// Get the scale factor from the highest scale monitor.
|
|
|
|
for (int i = 0; i < window->wl.monitorsCount; ++i) |
|
|
|
int maxScale = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < window->wl.monitorsCount; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
monitorScale = window->wl.monitors[i]->wl.scale; |
|
|
|
const int scale = window->wl.monitors[i]->wl.scale; |
|
|
|
if (scale < monitorScale) |
|
|
|
if (maxScale < scale) |
|
|
|
scale = monitorScale; |
|
|
|
maxScale = scale; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Only change the framebuffer size if the scale changed.
|
|
|
|
// Only change the framebuffer size if the scale changed.
|
|
|
|
if (scale != window->wl.scale) |
|
|
|
if (window->wl.scale != maxScale) |
|
|
|
{ |
|
|
|
{ |
|
|
|
window->wl.scale = scale; |
|
|
|
window->wl.scale = maxScale; |
|
|
|
wl_surface_set_buffer_scale(window->wl.surface, scale); |
|
|
|
wl_surface_set_buffer_scale(window->wl.surface, maxScale); |
|
|
|
resizeWindow(window); |
|
|
|
resizeWindow(window); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|