Accepting request 935168 from home:cornelisbb:branches:LibreOffice:Factory

- Fix UI scaling on HIDPI Wayland/KDE screens
  https://bugs.documentfoundation.org/show_bug.cgi?id=137924
  + fix-wayland-scaling-in-plasma.patch

OBS-URL: https://build.opensuse.org/request/show/935168
OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=985
This commit is contained in:
Fridrich Strba 2021-12-03 10:11:48 +00:00 committed by Git OBS Bridge
parent 562a91d057
commit 8edfba6392
3 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,79 @@
From dc0016bc8d7e6c4456f4442c7ccf287bfc0c2e9b Mon Sep 17 00:00:00 2001
From: Michael Weghorn <m.weghorn@posteo.de>
Date: Thu, 18 Nov 2021 21:15:10 +0100
Subject: [PATCH] tdf#137924 qt (>=5.14): Use proper DPI without requiring
window handle
For Qt >= 5.14, don't require a window handle to retrieve
the screen and then the associated DPI value from that one,
but directly use 'QWidget::screen' (introduced in QT 5.14)
to retrieve the screen.
Previously, no DPI values would be set in case there was
no window handle.
This makes UI scaling work without having to manually set
'SAL_FORCEDPI' on Wayland.
While various UI elements (like e.g. the "Help" -> "About LibreOffice"
still look quite broken with the qt5 and kf5 VCL plugins
in a Plasma Wayland session (at least on my Debian testing with
Qt 5.15.2 and Plasma 5.23), they look OK
when using the qt6 VCL plugin with a custom build of qtbase
and qtwayland from Qt's "dev" git branches.
Change-Id: I5feae46ed86a8b7d3cf92d4a973f7a0f9a9f95de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125507
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
---
vcl/qt5/QtGraphics_GDI.cxx | 9 ++++++++-
vcl/qt5/QtSvpGraphics.cxx | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index 0f9faa022d0b5..f87de50827dfc 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -746,10 +746,17 @@ void QtGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
return;
}
- if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+ if (!m_pFrame)
+ return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ QScreen* pScreen = m_pFrame->GetQWidget()->screen();
+#else
+ if (!m_pFrame->GetQWidget()->window()->windowHandle())
return;
QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+#endif
rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
}
diff --git a/vcl/qt5/Qt5SvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx
index b6018a95e2997..3632c8990706c 100644
--- a/vcl/qt5/Qt5SvpGraphics.cxx
+++ b/vcl/qt5/Qt5SvpGraphics.cxx
@@ -102,10 +102,17 @@ void QtSvpGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
return;
}
- if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+ if (!m_pFrame)
+ return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ QScreen* pScreen = m_pFrame->GetQWidget()->screen();
+#else
+ if (!m_pFrame->GetQWidget()->window()->windowHandle())
return;
QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+#endif
rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
}

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Dec 2 12:23:17 UTC 2021 - Cor Blom <cornelis@solcon.nl>
- Fix UI scaling on HIDPI Wayland/KDE screens
https://bugs.documentfoundation.org/show_bug.cgi?id=137924
+ fix-wayland-scaling-in-plasma.patch
-------------------------------------------------------------------
Wed Nov 24 16:33:53 UTC 2021 - Danilo Spinella <danilo.spinella@suse.com>

View File

@ -105,6 +105,8 @@ Patch3: mediawiki-no-broken-help.diff
# PATCH-FIX-OPENSUSE boo#1186110 fix GCC 11 error
Patch6: gcc11-fix-error.patch
Patch7: pld-skia-patches.patch
# PATCH-FIX-UPSTREAM https://bugs.documentfoundation.org/show_bug.cgi?id=137924 Use proper DPI without requiring window handle
Patch8: fix-wayland-scaling-in-plasma.patch
# Build with java 8
Patch101: 0001-Revert-java-9-changes.patch
# try to save space by using hardlinks
@ -984,6 +986,7 @@ Provides %{langname} translations and additional resources (help files, etc.) fo
%patch3
%patch6 -p1
%patch7 -p1
%patch8 -p1
%if 0%{?suse_version} < 1500
%patch101 -p1
%endif