From 39de55eebf0641bd32fd0af9be7e2f50a9e2bbbc Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 20 Jul 2014 22:30:49 +0200 Subject: [PATCH 1/2] If the dpi calculations don't give a reasonably square pixel fallback to other methods BUGS: 336018 FIXED-IN: 4.14.0 --- core/utils.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/core/utils.cpp b/core/utils.cpp index 7f1a7eac8..a3558b066 100644 --- a/core/utils.cpp +++ b/core/utils.cpp @@ -150,7 +150,11 @@ QSizeF Utils::realDpi(QWidget* widgetOnScreen) kDebug() << "Output is vertical, transposing DPI rect"; res.transpose(); } - return res; + if (qAbs(res.width() - res.height()) / qMin(res.height(), res.width()) < 0.05) { + return res; + } else { + kDebug() << "KScreen calculation returned a non square dpi." << res << ". Falling back"; + } } } else @@ -166,7 +170,22 @@ QSizeF Utils::realDpi(QWidget* widgetOnScreen) } // this is also fallback for LibKScreen branch if KScreen::Output // for particular widget was not found - return QSizeF(realDpiX(), realDpiY()); + QSizeF res = QSizeF(realDpiX(), realDpiY()); + if (qAbs(res.width() - res.height()) / qMin(res.height(), res.width()) < 0.05) { + return res; + } else { + kDebug() << "QDesktopWidget calculation returned a non square dpi." << res << ". Falling back"; + } + + res = QSizeF(dpiX(), dpiY()); + if (qAbs(res.width() - res.height()) / qMin(res.height(), res.width()) < 0.05) { + return res; + } else { + kDebug() << "QX11Info returned a non square dpi." << res << ". Falling back"; + } + + res = QSizeF(72, 72); + return res; } #elif defined(Q_WS_MAC) From 60bcd3975d87b97ab27b84369f9dfb56244ce268 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 21 Jul 2014 23:48:44 +0200 Subject: [PATCH 2/2] Prepare for 4.14 Beta 3 --- VERSION | 2 +- core/version.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index e356df2b1..9737c79e7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -okular v0.19.90 +okular v0.19.95 diff --git a/core/version.h b/core/version.h index 0c87bc577..e0371c1e7 100644 --- a/core/version.h +++ b/core/version.h @@ -10,10 +10,10 @@ #ifndef _OKULAR_VERSION_H_ #define _OKULAR_VERSION_H_ -#define OKULAR_VERSION_STRING "0.19.90" +#define OKULAR_VERSION_STRING "0.19.95" #define OKULAR_VERSION_MAJOR 0 #define OKULAR_VERSION_MINOR 19 -#define OKULAR_VERSION_RELEASE 90 +#define OKULAR_VERSION_RELEASE 95 #define OKULAR_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) #define OKULAR_VERSION \