From 61a77e19efd7c0a80cf3410cdaed4a2de0ec2dc0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 Oct 2019 09:10:01 +0530 Subject: [PATCH] X11: Fix content scale fallback value on KDE From upstream: https://github.com/glfw/glfw/commit/75294462b354d147aa5914c30e3005551cc04e4a --- glfw/x11_init.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/glfw/x11_init.c b/glfw/x11_init.c index 33e9054b8..6b6a394e3 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -433,12 +433,10 @@ static bool initExtensions(void) // void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, bool bypass_cache) { - // NOTE: Default to the display-wide DPI as we don't currently have a policy - // for which monitor a window is considered to be on - float xdpi = DisplayWidth(_glfw.x11.display, _glfw.x11.screen) * - 25.4f / DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen); - float ydpi = DisplayHeight(_glfw.x11.display, _glfw.x11.screen) * - 25.4f / DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen); + // Start by assuming the default X11 DPI + // NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it + // would be set to 96, so assume that is the case if we cannot find it + float xdpi = 96.f, ydpi = 96.f; // NOTE: Basing the scale on Xft.dpi where available should provide the most // consistent user experience (matches Qt, Gtk, etc), although not