From b21ecf062a11506b0023933fd2151fdf069f60de Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 12 May 2017 18:08:20 +0200 Subject: [PATCH] Client: Return a fixed value for the logical screen DPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][QPA plugin] Font and UI scaling is now based on the screen scale factor rather than the physical DPI. The logical DPI is set to 96 unless overridden by the the environment variable QT_WAYLAND_FORCE_DPI, which may be set to a specific DPI or to "physical" to get the old behavior. Change-Id: Ife417bf5537b0f6c9ecceffea46937951770b150 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 892ef974b47..38d61f88c35 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -123,11 +123,15 @@ QSizeF QWaylandScreen::physicalSize() const QDpi QWaylandScreen::logicalDpi() const { - static int force_dpi = !qgetenv("QT_WAYLAND_FORCE_DPI").isEmpty() ? qgetenv("QT_WAYLAND_FORCE_DPI").toInt() : -1; - if (force_dpi > 0) - return QDpi(force_dpi, force_dpi); + static bool physicalDpi = qEnvironmentVariable("QT_WAYLAND_FORCE_DPI") == QStringLiteral("physical"); + if (physicalDpi) + return QPlatformScreen::logicalDpi(); - return QPlatformScreen::logicalDpi(); + static int forceDpi = qgetenv("QT_WAYLAND_FORCE_DPI").toInt(); + if (forceDpi) + return QDpi(forceDpi, forceDpi); + + return QDpi(96, 96); } QList QWaylandScreen::virtualSiblings() const