From 1350653d4497a15857d1c904df447be3766042e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 13 May 2016 10:21:19 +0200 Subject: [PATCH] [plugins/qpa] Add support for QT_WAYLAND_FORCE_DPI env variable Summary: If a user specifies the QT_WAYLAND_FORCE_DPI env variable, KWin uses it to force a logicalDPI, just like QtWayland. Test Plan: Normally sized window decorations Reviewers: #plasma Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1605 --- CMakeLists.txt | 2 +- plugins/qpa/screen.cpp | 10 ++++++++++ plugins/qpa/screen.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cfff39667..d9632589ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ set(PROJECT_VERSION "5.6.90") set(PROJECT_VERSION_MAJOR 5) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -set(QT_MIN_VERSION "5.4.0") +set(QT_MIN_VERSION "5.5.0") set(KF5_MIN_VERSION "5.12.0") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} ) diff --git a/plugins/qpa/screen.cpp b/plugins/qpa/screen.cpp index f73a1b811e..60687ee6c5 100644 --- a/plugins/qpa/screen.cpp +++ b/plugins/qpa/screen.cpp @@ -62,5 +62,15 @@ QPlatformCursor *Screen::cursor() const return m_cursor.data(); } +QDpi Screen::logicalDpi() const +{ + static int force_dpi = qEnvironmentVariableIsSet("QT_WAYLAND_FORCE_DPI") ? qEnvironmentVariableIntValue("QT_WAYLAND_FORCE_DPI") : -1; + if (force_dpi > 0) { + return QDpi(force_dpi, force_dpi); + } + + return QPlatformScreen::logicalDpi(); +} + } } diff --git a/plugins/qpa/screen.h b/plugins/qpa/screen.h index fc9ba323ed..d7b98977d0 100644 --- a/plugins/qpa/screen.h +++ b/plugins/qpa/screen.h @@ -47,6 +47,7 @@ public: QImage::Format format() const override; QSizeF physicalSize() const override; QPlatformCursor *cursor() const override; + QDpi logicalDpi() const override; private: KWayland::Client::Output *m_output;