From 2c05229141a191a157400014aa2e7d6808371ffa Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 11 Feb 2021 11:31:35 +0200 Subject: [PATCH] qpa: Set minimum device ratio of 1 for windows This is to prevent rendering issues in the present windows close buttons as Qt supports scale factors that are less than one poorly. --- src/plugins/qpa/window.cpp | 2 +- src/plugins/qpa/window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qpa/window.cpp b/src/plugins/qpa/window.cpp index 4996e7a532..940a4e1c56 100644 --- a/src/plugins/qpa/window.cpp +++ b/src/plugins/qpa/window.cpp @@ -29,7 +29,7 @@ Window::Window(QWindow *window) : QPlatformWindow(window) , m_eglDisplay(kwinApp()->platform()->sceneEglDisplay()) , m_windowId(++s_windowId) - , m_scale(screens()->maxScale()) + , m_scale(std::max(qreal(1), screens()->maxScale())) { if (window->surfaceType() == QSurface::OpenGLSurface) { // The window will use OpenGL for drawing. diff --git a/src/plugins/qpa/window.h b/src/plugins/qpa/window.h index f6ab863e72..105d60da64 100644 --- a/src/plugins/qpa/window.h +++ b/src/plugins/qpa/window.h @@ -57,7 +57,7 @@ private: EGLSurface m_eglSurface = EGL_NO_SURFACE; quint32 m_windowId; bool m_resized = false; - int m_scale = 1; + qreal m_scale = 1; }; }