diff --git a/README.md b/README.md index 1bc45387..77844aaf 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ information on what to include when reporting a bug. - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) - [X11] Bugfix: Decorations could not be enabled after window creation (#1566) + - [X11] Bugfix: Content scale fallback value could be inconsistent (#1578) ## Contact diff --git a/src/x11_init.c b/src/x11_init.c index f00080d6..2f220ec5 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -793,13 +793,10 @@ static GLFWbool initExtensions(void) // static void getSystemContentScale(float* xscale, float* yscale) { - // NOTE: Fall back to the display-wide DPI instead of RandR monitor DPI if - // Xft.dpi retrieval below fails as we don't currently have an exact - // 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