vcl/qt5/Qt5Graphics_GDI.cxx | 4 ++-- vcl/unx/kde5/KDE5SalFrame.cxx | 2 +- vcl/unx/kde5/KDE5SalGraphics.cxx | 25 ++++++++++++++++++++++++- vcl/unx/kde5/KDE5SalGraphics.hxx | 7 ++++++- 4 files changed, 33 insertions(+), 5 deletions(-)
New commits: commit f93f0d0d85299b6f27aece0c93d045f3f4613cb1 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Thu Jan 17 14:01:51 2019 +0000 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Wed Feb 6 16:32:17 2019 +0100 Qt5/KDE5 use logicalDotsPerInch to report DPI It looks like all other backend don't use the physical, but the logical DPI to report the resolution. So use the QScreens logical resolution when reporting the DPI values. Also use QScreen for KDE5, as the Svp defaults to 96. This might fix tdf#122131, but since I can't reproduce... Change-Id: Iefc75acf26f8664f2a9ad995edbdc749be2228cf Reviewed-on: https://gerrit.libreoffice.org/66525 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> (cherry picked from commit b0b089e8f7a6df793761bdec6ee9d98b1bf12a5a) Reviewed-on: https://gerrit.libreoffice.org/67410 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx index 156c487ad57d..90baba36d3f0 100644 --- a/vcl/qt5/Qt5Graphics_GDI.cxx +++ b/vcl/qt5/Qt5Graphics_GDI.cxx @@ -643,8 +643,8 @@ void Qt5Graphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) return; QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen(); - rDPIX = pScreen->physicalDotsPerInchX(); - rDPIY = pScreen->physicalDotsPerInchY(); + rDPIX = pScreen->logicalDotsPerInchX(); + rDPIY = pScreen->logicalDotsPerInchY(); } sal_uInt16 Qt5Graphics::GetBitCount() const { return getFormatBits(m_pQImage->format()); } diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx index c4b72f3afa89..d3a13968237f 100644 --- a/vcl/unx/kde5/KDE5SalFrame.cxx +++ b/vcl/unx/kde5/KDE5SalFrame.cxx @@ -210,7 +210,7 @@ SalGraphics* KDE5SalFrame::AcquireGraphics() if (!m_pKDE5Graphics.get()) { - m_pKDE5Graphics.reset(new KDE5SalGraphics()); + m_pKDE5Graphics.reset(new KDE5SalGraphics(this)); Qt5Frame::InitSvpSalGraphics(m_pKDE5Graphics.get()); } diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx index 583edf6e8e6c..290127d0526e 100644 --- a/vcl/unx/kde5/KDE5SalGraphics.cxx +++ b/vcl/unx/kde5/KDE5SalGraphics.cxx @@ -21,7 +21,11 @@ #include <salbmp.hxx> +#include <QtGui/QScreen> +#include <QtGui/QWindow> + #include <Qt5Tools.hxx> +#include <Qt5Frame.hxx> static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf) { @@ -35,8 +39,9 @@ static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf) } } -KDE5SalGraphics::KDE5SalGraphics() +KDE5SalGraphics::KDE5SalGraphics(Qt5Frame* pFrame) : SvpSalGraphics() + , m_pFrame(pFrame) { } @@ -59,4 +64,22 @@ bool KDE5SalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, return bHandled; } +void KDE5SalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) +{ + char* pForceDpi; + if ((pForceDpi = getenv("SAL_FORCEDPI"))) + { + OString sForceDPI(pForceDpi); + rDPIX = rDPIY = sForceDPI.toInt32(); + return; + } + + if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle()) + return; + + QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen(); + rDPIX = pScreen->logicalDotsPerInchX(); + rDPIY = pScreen->logicalDotsPerInchY(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalGraphics.hxx b/vcl/unx/kde5/KDE5SalGraphics.hxx index d5b01542e877..109a0fa8ac29 100644 --- a/vcl/unx/kde5/KDE5SalGraphics.hxx +++ b/vcl/unx/kde5/KDE5SalGraphics.hxx @@ -29,13 +29,15 @@ #include <QtGui/QImage> #include <QtWidgets/QPushButton> +class Qt5Frame; + /** * Handles native graphics requests and performs the needed drawing operations. */ class KDE5SalGraphics : public SvpSalGraphics { public: - KDE5SalGraphics(); + KDE5SalGraphics(Qt5Frame* pFrame); virtual bool IsNativeControlSupported(ControlType, ControlPart) override; virtual bool hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&, @@ -48,8 +50,11 @@ public: ControlState, const ImplControlValue&, const OUString&, tools::Rectangle&, tools::Rectangle&) override; + virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; + private: Qt5Graphics_Controls m_aControl; + Qt5Frame* m_pFrame; }; inline bool KDE5SalGraphics::IsNativeControlSupported(ControlType nType, ControlPart nPart) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits