Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:alarrosa:branches:YaST:Head
libqt5-qtbase
0001-Read-DPI-from-X-Settings-initially-as-well...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Read-DPI-from-X-Settings-initially-as-well.patch of Package libqt5-qtbase
From 33d829434189ecbe9e3f1b6b179845215aee7867 Mon Sep 17 00:00:00 2001 From: Ilya Fedin <fedin-ilja2010@ya.ru> Date: Mon, 12 Apr 2021 13:14:52 +0400 Subject: [PATCH] Read DPI from X Settings initially as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, Xft.dpi from X Resources is read initially, while changes are monitored for Xft/DPI from X Settings. These protocols are different and can have different values. E.g. MATE sets X Resources' Xft.dpi to 96.30859375, while X Settings' Xft/DPI is set to 197240 at 2x scale. This results in a very weird bug when Qt can't determine 2x scale initially, but if scale is changed at run time, Qt changes scale to the right value. The difference could be checked via xrdb -query and dump_xsettings (the second is from xsettingsd project). [ChangeLog] Qt now reads Xft/DPI from X settings at startup, and will prefer this value over Xft.dpi from X resources. Pick-to: 6.0 6.1 5.15 Change-Id: If6adac0c88198579332ddebc673f1524f324c0e4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 6560778616b090f8cc73700675ec2ef385953fb6) --- src/plugins/platforms/xcb/qxcbscreen.cpp | 23 ++++++++++++++++------- src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index e637ed827c..2d0dfe603b 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -114,17 +114,13 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t } auto dpiChangedCallback = [](QXcbVirtualDesktop *desktop, const QByteArray &, const QVariant &property, void *) { - bool ok; - int dpiTimes1k = property.toInt(&ok); - if (!ok) + if (!desktop->setDpiFromXSettings(property)) return; - int dpi = dpiTimes1k / 1024; - if (desktop->m_forcedDpi == dpi) - return; - desktop->m_forcedDpi = dpi; + const auto dpi = desktop->forcedDpi(); for (QXcbScreen *screen : desktop->connection()->screens()) QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen->QPlatformScreen::screen(), dpi, dpi); }; + setDpiFromXSettings(xSettings()->setting("Xft/DPI")); xSettings()->registerCallbackForProperty("Xft/DPI", dpiChangedCallback, nullptr); } @@ -420,6 +416,19 @@ void QXcbVirtualDesktop::readXResources() } } +bool QXcbVirtualDesktop::setDpiFromXSettings(const QVariant &property) +{ + bool ok; + int dpiTimes1k = property.toInt(&ok); + if (!ok) + return false; + int dpi = dpiTimes1k / 1024; + if (m_forcedDpi == dpi) + return false; + m_forcedDpi = dpi; + return true; +} + QSurfaceFormat QXcbVirtualDesktop::surfaceFormatFor(const QSurfaceFormat &format) const { const xcb_visualid_t xcb_visualid = connection()->hasDefaultVisualId() ? connection()->defaultVisualId() diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ad2980b55e..8c7bf8c4a0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -118,6 +118,8 @@ private: QByteArray &stringValue); void readXResources(); + bool setDpiFromXSettings(const QVariant &property); + xcb_screen_t *m_screen; const int m_number; QList<QPlatformScreen *> m_screens; -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor