pull in some upstream crash fixes
This commit is contained in:
parent
dc07d438ad
commit
8a09cd6061
@ -0,0 +1,40 @@
|
|||||||
|
From 1eac947ce2c1d63bd04a94939c4f04e9086913c7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
|
||||||
|
Date: Wed, 22 May 2019 14:01:41 +0200
|
||||||
|
Subject: [PATCH 010/105] Work around crash where a destroyed window becomes
|
||||||
|
focus_window
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Clear QGuiApplication::focus_window (again) in the
|
||||||
|
QWindow destructor.
|
||||||
|
|
||||||
|
Task-number: QTBUG-75326
|
||||||
|
Change-Id: Ief00b6adfb267fcc7e3881fd728e12df07fc1094
|
||||||
|
Reviewed-by: Christian Andersen <csandersen3@gmail.com>
|
||||||
|
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
|
||||||
|
---
|
||||||
|
src/gui/kernel/qwindow.cpp | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
|
||||||
|
index bcd8351619..a19df4da0f 100644
|
||||||
|
--- a/src/gui/kernel/qwindow.cpp
|
||||||
|
+++ b/src/gui/kernel/qwindow.cpp
|
||||||
|
@@ -218,6 +218,12 @@ QWindow::~QWindow()
|
||||||
|
QGuiApplicationPrivate::window_list.removeAll(this);
|
||||||
|
if (!QGuiApplicationPrivate::is_app_closing)
|
||||||
|
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
|
||||||
|
+
|
||||||
|
+ // focus_window is normally cleared in destroy(), but the window may in
|
||||||
|
+ // some cases end up becoming the focus window again. Clear it again
|
||||||
|
+ // here as a workaround. See QTBUG-75326.
|
||||||
|
+ if (QGuiApplicationPrivate::focus_window == this)
|
||||||
|
+ QGuiApplicationPrivate::focus_window = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWindowPrivate::init(QScreen *targetScreen)
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
100
0054-Fix-crash-when-app-is-going-to-shutdown-but-conf-man.patch
Normal file
100
0054-Fix-crash-when-app-is-going-to-shutdown-but-conf-man.patch
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
From 9b6928b7cc6f12638ae625c67ecf437cfc694498 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Val Doroshchuk <valentyn.doroshchuk@qt.io>
|
||||||
|
Date: Fri, 31 May 2019 14:15:53 +0200
|
||||||
|
Subject: [PATCH 054/105] Fix crash when app is going to shutdown but conf
|
||||||
|
manager is requested
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
If the app is finished and going to shutdown,
|
||||||
|
qNetworkConfigurationManagerPrivate() returns nullptr.
|
||||||
|
|
||||||
|
Change-Id: I01915021d8698802b3a1d0dee43203cd3d4aba74
|
||||||
|
Task-number: QTBUG-76090
|
||||||
|
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
|
||||||
|
---
|
||||||
|
src/network/bearer/qnetworkconfigmanager.cpp | 27 ++++++++++----------
|
||||||
|
src/network/bearer/qnetworksession.cpp | 3 ++-
|
||||||
|
src/plugins/bearer/qnetworksession_impl.cpp | 13 +++++-----
|
||||||
|
3 files changed, 23 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
|
||||||
|
index 81b5e01d6a..cd87c3669c 100644
|
||||||
|
--- a/src/network/bearer/qnetworkconfigmanager.cpp
|
||||||
|
+++ b/src/network/bearer/qnetworkconfigmanager.cpp
|
||||||
|
@@ -233,19 +233,20 @@ QNetworkConfigurationManager::QNetworkConfigurationManager(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
|
||||||
|
-
|
||||||
|
- connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)),
|
||||||
|
- this, SIGNAL(configurationAdded(QNetworkConfiguration)));
|
||||||
|
- connect(priv, SIGNAL(configurationRemoved(QNetworkConfiguration)),
|
||||||
|
- this, SIGNAL(configurationRemoved(QNetworkConfiguration)));
|
||||||
|
- connect(priv, SIGNAL(configurationChanged(QNetworkConfiguration)),
|
||||||
|
- this, SIGNAL(configurationChanged(QNetworkConfiguration)));
|
||||||
|
- connect(priv, SIGNAL(onlineStateChanged(bool)),
|
||||||
|
- this, SIGNAL(onlineStateChanged(bool)));
|
||||||
|
- connect(priv, SIGNAL(configurationUpdateComplete()),
|
||||||
|
- this, SIGNAL(updateCompleted()));
|
||||||
|
-
|
||||||
|
- priv->enablePolling();
|
||||||
|
+ if (priv) {
|
||||||
|
+ connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)),
|
||||||
|
+ this, SIGNAL(configurationAdded(QNetworkConfiguration)));
|
||||||
|
+ connect(priv, SIGNAL(configurationRemoved(QNetworkConfiguration)),
|
||||||
|
+ this, SIGNAL(configurationRemoved(QNetworkConfiguration)));
|
||||||
|
+ connect(priv, SIGNAL(configurationChanged(QNetworkConfiguration)),
|
||||||
|
+ this, SIGNAL(configurationChanged(QNetworkConfiguration)));
|
||||||
|
+ connect(priv, SIGNAL(onlineStateChanged(bool)),
|
||||||
|
+ this, SIGNAL(onlineStateChanged(bool)));
|
||||||
|
+ connect(priv, SIGNAL(configurationUpdateComplete()),
|
||||||
|
+ this, SIGNAL(updateCompleted()));
|
||||||
|
+
|
||||||
|
+ priv->enablePolling();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
|
||||||
|
index 471d322998..1636bcee97 100644
|
||||||
|
--- a/src/network/bearer/qnetworksession.cpp
|
||||||
|
+++ b/src/network/bearer/qnetworksession.cpp
|
||||||
|
@@ -258,7 +258,8 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig,
|
||||||
|
|
||||||
|
// invalid configuration
|
||||||
|
if (!connectionConfig.identifier().isEmpty()) {
|
||||||
|
- const auto engines = qNetworkConfigurationManagerPrivate()->engines();
|
||||||
|
+ auto priv = qNetworkConfigurationManagerPrivate();
|
||||||
|
+ const auto engines = priv ? priv->engines() : QList<QBearerEngine *>();
|
||||||
|
for (QBearerEngine *engine : engines) {
|
||||||
|
if (engine->hasIdentifier(connectionConfig.identifier())) {
|
||||||
|
d = engine->createSessionBackend();
|
||||||
|
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
|
||||||
|
index 847479047f..903525a204 100644
|
||||||
|
--- a/src/plugins/bearer/qnetworksession_impl.cpp
|
||||||
|
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
|
||||||
|
@@ -56,12 +56,13 @@ QT_BEGIN_NAMESPACE
|
||||||
|
static QBearerEngineImpl *getEngineFromId(const QString &id)
|
||||||
|
{
|
||||||
|
QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
|
||||||
|
-
|
||||||
|
- const auto engines = priv->engines();
|
||||||
|
- for (QBearerEngine *engine : engines) {
|
||||||
|
- QBearerEngineImpl *engineImpl = qobject_cast<QBearerEngineImpl *>(engine);
|
||||||
|
- if (engineImpl && engineImpl->hasIdentifier(id))
|
||||||
|
- return engineImpl;
|
||||||
|
+ if (priv) {
|
||||||
|
+ const auto engines = priv->engines();
|
||||||
|
+ for (QBearerEngine *engine : engines) {
|
||||||
|
+ QBearerEngineImpl *engineImpl = qobject_cast<QBearerEngineImpl *>(engine);
|
||||||
|
+ if (engineImpl && engineImpl->hasIdentifier(id))
|
||||||
|
+ return engineImpl;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
373
0056-QHighDpi-Replace-fromNative-toNative-with-scale.patch
Normal file
373
0056-QHighDpi-Replace-fromNative-toNative-with-scale.patch
Normal file
@ -0,0 +1,373 @@
|
|||||||
|
From 7ae2f47214408fb37ccb52d1fa659cc47a63443b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
|
||||||
|
Date: Tue, 5 Mar 2019 00:17:43 +0100
|
||||||
|
Subject: [PATCH 056/105] QHighDpi: Replace fromNative()/toNative() with
|
||||||
|
scale()
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
We need one scale() function for each type: the scale factor can be
|
||||||
|
inverted by the caller for the fromNative case. Add a generic
|
||||||
|
templated implementation which will handle simple types. Add add
|
||||||
|
specialization functions for compound types that don't have
|
||||||
|
operator*(), as well as for position types (e.g. QPoint) which account
|
||||||
|
for the origin.
|
||||||
|
|
||||||
|
There's no need for fromNativePixels() and toNativePixels() overloads
|
||||||
|
for each type; replace with generic implementations which call
|
||||||
|
scale(). Do the same thing for fromNativeLocalPosition().
|
||||||
|
|
||||||
|
Some user code is calling fromNative()/toNative() directly, so leave a
|
||||||
|
definition of those functions around for now. Also leave a couple of
|
||||||
|
one-off scaling functions which do not fit the pattern.
|
||||||
|
|
||||||
|
Also fix “narrowing conversion scaleFactor to int” warning for the
|
||||||
|
QMargins scale function.
|
||||||
|
|
||||||
|
Change-Id: Ia67accbb670a80dc1747c2e264b97aab75b1251b
|
||||||
|
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
||||||
|
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
|
||||||
|
---
|
||||||
|
src/gui/kernel/qhighdpiscaling_p.h | 264 ++++++-----------------------
|
||||||
|
1 file changed, 55 insertions(+), 209 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
|
||||||
|
index dfc6abf5ba..525e3fe78e 100644
|
||||||
|
--- a/src/gui/kernel/qhighdpiscaling_p.h
|
||||||
|
+++ b/src/gui/kernel/qhighdpiscaling_p.h
|
||||||
|
@@ -108,208 +108,114 @@ private:
|
||||||
|
|
||||||
|
namespace QHighDpi {
|
||||||
|
|
||||||
|
-inline QPointF fromNative(const QPointF &pos, qreal scaleFactor, const QPointF &origin)
|
||||||
|
+template <typename T>
|
||||||
|
+inline T scale(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- return (pos - origin) / scaleFactor + origin;
|
||||||
|
+ Q_UNUSED(origin)
|
||||||
|
+ return value * scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QPointF toNative(const QPointF &pos, qreal scaleFactor, const QPointF &origin)
|
||||||
|
+inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0))
|
||||||
|
{
|
||||||
|
return (pos - origin) * scaleFactor + origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QPoint fromNative(const QPoint &pos, qreal scaleFactor, const QPoint &origin)
|
||||||
|
-{
|
||||||
|
- return (pos - origin) / scaleFactor + origin;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QPoint toNative(const QPoint &pos, qreal scaleFactor, const QPoint &origin)
|
||||||
|
+inline QPoint scale(const QPoint &pos, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
return (pos - origin) * scaleFactor + origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QPoint fromNative(const QPoint &pos, qreal scaleFactor)
|
||||||
|
-{
|
||||||
|
- return pos / scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QPoint toNative(const QPoint &pos, qreal scaleFactor)
|
||||||
|
-{
|
||||||
|
- return pos * scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QSize fromNative(const QSize &size, qreal scaleFactor)
|
||||||
|
-{
|
||||||
|
- return size / scaleFactor; // TODO: should we round up?
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QSize toNative(const QSize &size, qreal scaleFactor)
|
||||||
|
+inline QRect scale(const QRect &rect, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- return size * scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QSizeF fromNative(const QSizeF &size, qreal scaleFactor)
|
||||||
|
-{
|
||||||
|
- return size / scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QSizeF toNative(const QSizeF &size, qreal scaleFactor)
|
||||||
|
-{
|
||||||
|
- return size * scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QRect fromNative(const QRect &rect, qreal scaleFactor, const QPoint &origin)
|
||||||
|
-{
|
||||||
|
- return QRect(fromNative(rect.topLeft(), scaleFactor, origin), fromNative(rect.size(), scaleFactor));
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QRect toNative(const QRect &rect, qreal scaleFactor, const QPoint &origin)
|
||||||
|
-{
|
||||||
|
- return QRect(toNative(rect.topLeft(), scaleFactor, origin), toNative(rect.size(), scaleFactor));
|
||||||
|
-
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QRect fromNative(const QRect &rect, const QScreen *screen, const QPoint &screenOrigin)
|
||||||
|
-{
|
||||||
|
- return fromNative(rect, QHighDpiScaling::factor(screen), screenOrigin);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QRect fromNativeScreenGeometry(const QRect &nativeScreenGeometry, const QScreen *screen)
|
||||||
|
-{
|
||||||
|
- return QRect(nativeScreenGeometry.topLeft(),
|
||||||
|
- fromNative(nativeScreenGeometry.size(), QHighDpiScaling::factor(screen)));
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QPoint fromNativeLocalPosition(const QPoint &pos, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- return pos / scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QPoint toNativeLocalPosition(const QPoint &pos, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- return pos * scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QPointF fromNativeLocalPosition(const QPointF &pos, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- return pos / scaleFactor;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-inline QPointF toNativeLocalPosition(const QPointF &pos, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- return pos * scaleFactor;
|
||||||
|
+ return QRect(scale(rect.topLeft(), scaleFactor, origin), scale(rect.size(), scaleFactor));
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QRect fromNativePixels(const QRect &pixelRect, const C *context)
|
||||||
|
+inline QRectF scale(const QRectF &rect, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(context);
|
||||||
|
- const QPoint origin = QHighDpiScaling::origin(context);
|
||||||
|
- return QRect(fromNative(pixelRect.topLeft(), scaleFactor, origin),
|
||||||
|
- fromNative(pixelRect.size(), scaleFactor));
|
||||||
|
+ return QRectF(scale(rect.topLeft(), scaleFactor, origin), scale(rect.size(), scaleFactor));
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QRect toNativePixels(const QRect &pointRect, const C *context)
|
||||||
|
+inline QMargins scale(const QMargins &margins, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(context);
|
||||||
|
- const QPoint origin = QHighDpiScaling::origin(context);
|
||||||
|
- return QRect(toNative(pointRect.topLeft(), scaleFactor, origin),
|
||||||
|
- toNative(pointRect.size(), scaleFactor));
|
||||||
|
+ Q_UNUSED(origin)
|
||||||
|
+ return QMargins(qRound(qreal(margins.left()) * scaleFactor), qRound(qreal(margins.top()) * scaleFactor),
|
||||||
|
+ qRound(qreal(margins.right()) * scaleFactor), qRound(qreal(margins.bottom()) * scaleFactor));
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QRectF toNativePixels(const QRectF &pointRect, const C *context)
|
||||||
|
+template <typename T>
|
||||||
|
+QVector<T> scale(const QVector<T> &vector, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(context);
|
||||||
|
- const QPoint origin = QHighDpiScaling::origin(context);
|
||||||
|
- return QRectF(toNative(pointRect.topLeft(), scaleFactor, origin),
|
||||||
|
- toNative(pointRect.size(), scaleFactor));
|
||||||
|
-}
|
||||||
|
+ if (!QHighDpiScaling::isActive())
|
||||||
|
+ return vector;
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QRectF fromNativePixels(const QRectF &pixelRect, const C *context)
|
||||||
|
-{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(context);
|
||||||
|
- const QPoint origin = QHighDpiScaling::origin(context);
|
||||||
|
- return QRectF(fromNative(pixelRect.topLeft(), scaleFactor, origin),
|
||||||
|
- fromNative(pixelRect.size(), scaleFactor));
|
||||||
|
+ QVector<T> scaled;
|
||||||
|
+ scaled.reserve(vector.size());
|
||||||
|
+ for (const T &item : vector)
|
||||||
|
+ scaled.append(scale(item, scaleFactor, origin));
|
||||||
|
+ return scaled;
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QSize fromNativePixels(const QSize &pixelSize, const QWindow *window)
|
||||||
|
+inline QRegion scale(const QRegion ®ion, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- return pixelSize / QHighDpiScaling::factor(window);
|
||||||
|
-}
|
||||||
|
+ if (!QHighDpiScaling::isActive())
|
||||||
|
+ return region;
|
||||||
|
|
||||||
|
-inline QSize toNativePixels(const QSize &pointSize, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- return pointSize * QHighDpiScaling::factor(window);
|
||||||
|
+ QRegion scaled;
|
||||||
|
+ for (const QRect &rect : region)
|
||||||
|
+ scaled += scale(rect, scaleFactor, origin);
|
||||||
|
+ return scaled;
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QSizeF fromNativePixels(const QSizeF &pixelSize, const QWindow *window)
|
||||||
|
+template <typename T, typename C>
|
||||||
|
+T fromNativePixels(const T &value, const C *context)
|
||||||
|
{
|
||||||
|
- return pixelSize / QHighDpiScaling::factor(window);
|
||||||
|
+ return scale(value, qreal(1) / QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QSizeF toNativePixels(const QSizeF &pointSize, const QWindow *window)
|
||||||
|
+template <typename T, typename C>
|
||||||
|
+T toNativePixels(const T &value, const C *context)
|
||||||
|
{
|
||||||
|
- return pointSize * QHighDpiScaling::factor(window);
|
||||||
|
+ return scale(value, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QPoint fromNativePixels(const QPoint &pixelPoint, const C *context)
|
||||||
|
+template <typename T, typename C>
|
||||||
|
+T fromNativeLocalPosition(const T &value, const C *context)
|
||||||
|
{
|
||||||
|
- return fromNative(pixelPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
+ return scale(value, qreal(1) / QHighDpiScaling::factor(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QPoint toNativePixels(const QPoint &pointPoint, const C *context)
|
||||||
|
+template <typename T, typename C>
|
||||||
|
+T toNativeLocalPosition(const T &value, const C *context)
|
||||||
|
{
|
||||||
|
- return toNative(pointPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
+ return scale(value, QHighDpiScaling::factor(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QPointF fromNativePixels(const QPointF &pixelPoint, const C *context)
|
||||||
|
+template <typename T>
|
||||||
|
+inline T fromNative(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- return fromNative(pixelPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
+ return scale(value, qreal(1) / scaleFactor, origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
-template <typename C>
|
||||||
|
-inline QPointF toNativePixels(const QPointF &pointPoint, const C *context)
|
||||||
|
+template <typename T>
|
||||||
|
+inline T toNative(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
||||||
|
{
|
||||||
|
- return toNative(pointPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
+ return scale(value, scaleFactor, origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QMargins fromNativePixels(const QMargins &pixelMargins, const QWindow *window)
|
||||||
|
+inline QRect fromNative(const QRect &rect, const QScreen *screen, const QPoint &screenOrigin)
|
||||||
|
{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- return QMargins(pixelMargins.left() / scaleFactor, pixelMargins.top() / scaleFactor,
|
||||||
|
- pixelMargins.right() / scaleFactor, pixelMargins.bottom() / scaleFactor);
|
||||||
|
+ return scale(rect, qreal(1) / QHighDpiScaling::factor(screen), screenOrigin);
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline QMargins toNativePixels(const QMargins &pointMargins, const QWindow *window)
|
||||||
|
+inline QRect fromNativeScreenGeometry(const QRect &nativeScreenGeometry, const QScreen *screen)
|
||||||
|
{
|
||||||
|
- const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- return QMargins(pointMargins.left() * scaleFactor, pointMargins.top() * scaleFactor,
|
||||||
|
- pointMargins.right() * scaleFactor, pointMargins.bottom() * scaleFactor);
|
||||||
|
+ return QRect(nativeScreenGeometry.topLeft(),
|
||||||
|
+ scale(nativeScreenGeometry.size(), qreal(1) / QHighDpiScaling::factor(screen)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow *window)
|
||||||
|
{
|
||||||
|
- if (!QHighDpiScaling::isActive())
|
||||||
|
- return pixelRegion;
|
||||||
|
-
|
||||||
|
- qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- QRegion pointRegion;
|
||||||
|
- for (const QRect &rect : pixelRegion) {
|
||||||
|
- pointRegion += QRect(fromNative(rect.topLeft(), scaleFactor),
|
||||||
|
- fromNative(rect.size(), scaleFactor));
|
||||||
|
- }
|
||||||
|
- return pointRegion;
|
||||||
|
+ return scale(pixelRegion, qreal(1) / QHighDpiScaling::factor(window));
|
||||||
|
}
|
||||||
|
|
||||||
|
// When mapping expose events to Qt rects: round top/left towards the origin and
|
||||||
|
@@ -333,67 +239,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
|
||||||
|
|
||||||
|
inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window)
|
||||||
|
{
|
||||||
|
- if (!QHighDpiScaling::isActive())
|
||||||
|
- return pointRegion;
|
||||||
|
-
|
||||||
|
- qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||||
|
- QRegion pixelRegon;
|
||||||
|
- for (const QRect &rect : pointRegion) {
|
||||||
|
- pixelRegon += QRect(toNative(rect.topLeft(), scaleFactor),
|
||||||
|
- toNative(rect.size(), scaleFactor));
|
||||||
|
- }
|
||||||
|
- return pixelRegon;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-// Any T that has operator/()
|
||||||
|
-template <typename T, typename C>
|
||||||
|
-T fromNativePixels(const T &pixelValue, const C *context)
|
||||||
|
-{
|
||||||
|
- if (!QHighDpiScaling::isActive())
|
||||||
|
- return pixelValue;
|
||||||
|
-
|
||||||
|
- return pixelValue / QHighDpiScaling::factor(context);
|
||||||
|
-
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-// Any T that has operator*()
|
||||||
|
-template <typename T, typename C>
|
||||||
|
-T toNativePixels(const T &pointValue, const C *context)
|
||||||
|
-{
|
||||||
|
- if (!QHighDpiScaling::isActive())
|
||||||
|
- return pointValue;
|
||||||
|
-
|
||||||
|
- return pointValue * QHighDpiScaling::factor(context);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-// Any QVector<T> where T has operator/()
|
||||||
|
-template <typename T>
|
||||||
|
-QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- if (!QHighDpiScaling::isActive())
|
||||||
|
- return pixelValues;
|
||||||
|
-
|
||||||
|
- QVector<T> pointValues;
|
||||||
|
- pointValues.reserve(pixelValues.size());
|
||||||
|
- const auto factor = QHighDpiScaling::factor(window);
|
||||||
|
- for (const T &pixelValue : pixelValues)
|
||||||
|
- pointValues.append(pixelValue / factor);
|
||||||
|
- return pointValues;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-// Any QVector<T> where T has operator*()
|
||||||
|
-template <typename T>
|
||||||
|
-QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
|
||||||
|
-{
|
||||||
|
- if (!QHighDpiScaling::isActive())
|
||||||
|
- return pointValues;
|
||||||
|
-
|
||||||
|
- QVector<T> pixelValues;
|
||||||
|
- pixelValues.reserve(pointValues.size());
|
||||||
|
- const auto factor = QHighDpiScaling::factor(window);
|
||||||
|
- for (const T &pointValue : pointValues)
|
||||||
|
- pixelValues.append(pointValue * factor);
|
||||||
|
- return pixelValues;
|
||||||
|
+ return scale(pointRegion, QHighDpiScaling::factor(window));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QHighDpi
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
33
0066-High-DPI-Fix-crash-in-QWindow-mapFromGlobal.patch
Normal file
33
0066-High-DPI-Fix-crash-in-QWindow-mapFromGlobal.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 6d61b10f65cd276e009a02cec563cc469245e1f2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
||||||
|
Date: Wed, 19 Jun 2019 08:28:14 +0200
|
||||||
|
Subject: [PATCH 066/105] High DPI: Fix crash in QWindow::mapFromGlobal()
|
||||||
|
|
||||||
|
With Web Engine, QQuickWidget or similar, the code can hit on the offscreen
|
||||||
|
window, when its handle is null. Add a check.
|
||||||
|
|
||||||
|
Amends 3af7b279177f7fb092f0e0fb9ffc8e8d846ed774.
|
||||||
|
|
||||||
|
Fixes: QTBUG-76440
|
||||||
|
Change-Id: I123633d18386efd3dbfb22aad6072e4f0877a62e
|
||||||
|
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
|
||||||
|
---
|
||||||
|
src/gui/kernel/qhighdpiscaling.cpp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
|
||||||
|
index 4f8e9a3817..93fcb1a216 100644
|
||||||
|
--- a/src/gui/kernel/qhighdpiscaling.cpp
|
||||||
|
+++ b/src/gui/kernel/qhighdpiscaling.cpp
|
||||||
|
@@ -400,7 +400,7 @@ QPoint QHighDpiScaling::mapPositionToGlobal(const QPoint &pos, const QPoint &win
|
||||||
|
QPoint QHighDpiScaling::mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window)
|
||||||
|
{
|
||||||
|
QPoint windowPosCandidate = pos - windowGlobalPosition;
|
||||||
|
- if (QGuiApplicationPrivate::screen_list.size() <= 1)
|
||||||
|
+ if (QGuiApplicationPrivate::screen_list.size() <= 1 || window->handle() == nullptr)
|
||||||
|
return windowPosCandidate;
|
||||||
|
|
||||||
|
// Device independent global (screen) space may discontiguous when high-dpi scaling
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
161
0100-QHighDpi-fromNativePixels-use-correct-screen.patch
Normal file
161
0100-QHighDpi-fromNativePixels-use-correct-screen.patch
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
From b6ded193ee64ffe67df6d22e7a23aa1ea9e02ec7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
|
||||||
|
Date: Tue, 5 Mar 2019 11:14:21 +0100
|
||||||
|
Subject: [PATCH 100/105] QHighDpi::fromNativePixels: use correct screen
|
||||||
|
|
||||||
|
Calls like
|
||||||
|
QHighDpi::fromNativePixels(point, window)
|
||||||
|
|
||||||
|
would return device independent coordinates outside any
|
||||||
|
screen in cases where the window is spanning multiple
|
||||||
|
screens and the native point was not on the main screen.
|
||||||
|
|
||||||
|
Correct this by looking up the correct screen and use
|
||||||
|
its scale factor and origin when scaling coordinates.
|
||||||
|
|
||||||
|
Task-number: QTBUG-73231
|
||||||
|
Change-Id: I01a3a42f42121b8d9f4ced2bb0fb023d6ae6bfe7
|
||||||
|
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
||||||
|
---
|
||||||
|
src/gui/kernel/qhighdpiscaling.cpp | 50 +++++++++---------------------
|
||||||
|
src/gui/kernel/qhighdpiscaling_p.h | 37 ++++++++++++++++------
|
||||||
|
2 files changed, 42 insertions(+), 45 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
|
||||||
|
index 93fcb1a216..0fea416404 100644
|
||||||
|
--- a/src/gui/kernel/qhighdpiscaling.cpp
|
||||||
|
+++ b/src/gui/kernel/qhighdpiscaling.cpp
|
||||||
|
@@ -452,52 +452,30 @@ QDpi QHighDpiScaling::logicalDpi()
|
||||||
|
return m_logicalDpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
-qreal QHighDpiScaling::factor(const QScreen *screen)
|
||||||
|
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformScreen *platformScreen, QPoint *nativePosition)
|
||||||
|
{
|
||||||
|
- // Fast path for when scaling in Qt is not used at all.
|
||||||
|
if (!m_active)
|
||||||
|
- return qreal(1.0);
|
||||||
|
-
|
||||||
|
- // The effective factor for a given screen is the product of the
|
||||||
|
- // screen and global sub-factors
|
||||||
|
- qreal factor = m_factor;
|
||||||
|
- if (screen)
|
||||||
|
- factor *= screenSubfactor(screen->handle());
|
||||||
|
- return factor;
|
||||||
|
+ return { qreal(1), QPoint() };
|
||||||
|
+ const QPlatformScreen *actualScreen = nativePosition ?
|
||||||
|
+ platformScreen->screenForPosition(*nativePosition) : platformScreen;
|
||||||
|
+ return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() };
|
||||||
|
}
|
||||||
|
|
||||||
|
-qreal QHighDpiScaling::factor(const QPlatformScreen *platformScreen)
|
||||||
|
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QScreen *screen, QPoint *nativePosition)
|
||||||
|
{
|
||||||
|
if (!m_active)
|
||||||
|
- return qreal(1.0);
|
||||||
|
-
|
||||||
|
- return m_factor * screenSubfactor(platformScreen);
|
||||||
|
+ return { qreal(1), QPoint() };
|
||||||
|
+ if (!screen)
|
||||||
|
+ return { m_factor, QPoint() }; // the global factor
|
||||||
|
+ return scaleAndOrigin(screen->handle(), nativePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
-qreal QHighDpiScaling::factor(const QWindow *window)
|
||||||
|
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QWindow *window, QPoint *nativePosition)
|
||||||
|
{
|
||||||
|
if (!m_active)
|
||||||
|
- return qreal(1.0);
|
||||||
|
-
|
||||||
|
- return factor(window ? window->screen() : QGuiApplication::primaryScreen());
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-QPoint QHighDpiScaling::origin(const QScreen *screen)
|
||||||
|
-{
|
||||||
|
- return screen->geometry().topLeft();
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-QPoint QHighDpiScaling::origin(const QPlatformScreen *platformScreen)
|
||||||
|
-{
|
||||||
|
- return platformScreen->geometry().topLeft();
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-QPoint QHighDpiScaling::origin(const QWindow *window)
|
||||||
|
-{
|
||||||
|
- if (window && window->isTopLevel() && window->screen())
|
||||||
|
- return window->screen()->geometry().topLeft();
|
||||||
|
-
|
||||||
|
- return QPoint(0, 0);
|
||||||
|
+ return { qreal(1), QPoint() };
|
||||||
|
+ QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
|
||||||
|
+ return scaleAndOrigin(screen, nativePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //QT_NO_HIGHDPISCALING
|
||||||
|
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
|
||||||
|
index 525e3fe78e..3410c1d345 100644
|
||||||
|
--- a/src/gui/kernel/qhighdpiscaling_p.h
|
||||||
|
+++ b/src/gui/kernel/qhighdpiscaling_p.h
|
||||||
|
@@ -78,14 +78,23 @@ public:
|
||||||
|
static void setScreenFactor(QScreen *window, qreal factor);
|
||||||
|
|
||||||
|
static bool isActive() { return m_active; }
|
||||||
|
- static qreal factor(const QWindow *window);
|
||||||
|
- static qreal factor(const QScreen *screen);
|
||||||
|
- static qreal factor(const QPlatformScreen *platformScreen);
|
||||||
|
- static QPoint origin(const QScreen *screen);
|
||||||
|
- static QPoint origin(const QPlatformScreen *platformScreen);
|
||||||
|
- static QPoint origin(const QWindow *window);
|
||||||
|
- static QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *platformScreen);
|
||||||
|
+
|
||||||
|
+ struct ScaleAndOrigin
|
||||||
|
+ {
|
||||||
|
+ qreal factor;
|
||||||
|
+ QPoint origin;
|
||||||
|
+ };
|
||||||
|
+ static ScaleAndOrigin scaleAndOrigin(const QPlatformScreen *platformScreen, QPoint *nativePosition = nullptr);
|
||||||
|
+ static ScaleAndOrigin scaleAndOrigin(const QScreen *screen, QPoint *nativePosition = nullptr);
|
||||||
|
+ static ScaleAndOrigin scaleAndOrigin(const QWindow *platformScreen, QPoint *nativePosition = nullptr);
|
||||||
|
+
|
||||||
|
+ template<typename C>
|
||||||
|
+ static qreal factor(C *context, QPoint *nativePosition = nullptr) {
|
||||||
|
+ return scaleAndOrigin(context, nativePosition).factor;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
static QPoint mapPositionFromNative(const QPoint &pos, const QPlatformScreen *platformScreen);
|
||||||
|
+ static QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *platformScreen);
|
||||||
|
static QPoint mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window);
|
||||||
|
static QPoint mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window);
|
||||||
|
static QDpi logicalDpi();
|
||||||
|
@@ -166,16 +175,26 @@ inline QRegion scale(const QRegion ®ion, qreal scaleFactor, QPoint origin = Q
|
||||||
|
return scaled;
|
||||||
|
}
|
||||||
|
|
||||||
|
+template <typename T>
|
||||||
|
+inline QPoint position(T) { return QPoint(); }
|
||||||
|
+inline QPoint position(QPoint point) { return point; }
|
||||||
|
+inline QPoint position(QPointF point) { return point.toPoint(); }
|
||||||
|
+inline QPoint position(QRect rect) { return rect.center(); }
|
||||||
|
+inline QPoint position(QRectF rect) { return rect.center().toPoint(); }
|
||||||
|
+
|
||||||
|
template <typename T, typename C>
|
||||||
|
T fromNativePixels(const T &value, const C *context)
|
||||||
|
{
|
||||||
|
- return scale(value, qreal(1) / QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
+ QPoint nativePosition = position(value);
|
||||||
|
+ QHighDpiScaling::ScaleAndOrigin so = QHighDpiScaling::scaleAndOrigin(context, &nativePosition);
|
||||||
|
+ return scale(value, qreal(1) / so.factor, so.origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename C>
|
||||||
|
T toNativePixels(const T &value, const C *context)
|
||||||
|
{
|
||||||
|
- return scale(value, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
|
||||||
|
+ QHighDpiScaling::ScaleAndOrigin so = QHighDpiScaling::scaleAndOrigin(context);
|
||||||
|
+ return scale(value, so.factor, so.origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename C>
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -53,7 +53,7 @@ BuildRequires: pkgconfig(libsystemd)
|
|||||||
Name: qt5-qtbase
|
Name: qt5-qtbase
|
||||||
Summary: Qt5 - QtBase components
|
Summary: Qt5 - QtBase components
|
||||||
Version: 5.12.4
|
Version: 5.12.4
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
|
|
||||||
# See LGPL_EXCEPTIONS.txt, for exception details
|
# See LGPL_EXCEPTIONS.txt, for exception details
|
||||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||||
@ -132,6 +132,11 @@ Patch68: qtbase-everywhere-src-5.11.1-python3.patch
|
|||||||
# https://bugs.kde.org/show_bug.cgi?id=406180
|
# https://bugs.kde.org/show_bug.cgi?id=406180
|
||||||
# https://codereview.qt-project.org/c/qt/qtbase/+/264563
|
# https://codereview.qt-project.org/c/qt/qtbase/+/264563
|
||||||
Patch100: fbf3488.diff
|
Patch100: fbf3488.diff
|
||||||
|
Patch110: 0010-Work-around-crash-where-a-destroyed-window-becomes-f.patch
|
||||||
|
Patch154: 0054-Fix-crash-when-app-is-going-to-shutdown-but-conf-man.patch
|
||||||
|
Patch156: 0056-QHighDpi-Replace-fromNative-toNative-with-scale.patch
|
||||||
|
Patch166: 0066-High-DPI-Fix-crash-in-QWindow-mapFromGlobal.patch
|
||||||
|
Patch200: 0100-QHighDpi-fromNativePixels-use-correct-screen.patch
|
||||||
|
|
||||||
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
|
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
|
||||||
# Those themes are there for platform integration. If the required libraries are
|
# Those themes are there for platform integration. If the required libraries are
|
||||||
@ -401,6 +406,11 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
|||||||
|
|
||||||
## upstream patches
|
## upstream patches
|
||||||
%patch100 -p1
|
%patch100 -p1
|
||||||
|
%patch110 -p1
|
||||||
|
%patch154 -p1
|
||||||
|
%patch156 -p1
|
||||||
|
%patch166 -p1
|
||||||
|
%patch200 -p1
|
||||||
|
|
||||||
# move some bundled libs to ensure they're not accidentally used
|
# move some bundled libs to ensure they're not accidentally used
|
||||||
pushd src/3rdparty
|
pushd src/3rdparty
|
||||||
@ -1020,6 +1030,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 26 2019 Rex Dieter <rdieter@fedoraproject.org> - 5.12.4-2
|
||||||
|
- pull in some upstream crash fixes
|
||||||
|
|
||||||
* Fri Jun 14 2019 Jan Grulich <jgrulich@redhat.com> - 5.12.4-1
|
* Fri Jun 14 2019 Jan Grulich <jgrulich@redhat.com> - 5.12.4-1
|
||||||
- 5.12.4
|
- 5.12.4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user