diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-18 20:45:53 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-18 20:50:35 +0100 |
commit | 4fe2fbcf827ae6bec976b0b8dcaa5d14bd05dc33 (patch) | |
tree | d1ba753b45b09b417a9447ebdfe2fa6fc47dba69 /src/gui/kernel | |
parent | c1da6347e8d3ba73de20ab8fb3e50ec3359b75ac (diff) | |
parent | 4889269ff0fb37130b332863e82dd7c19564116c (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8.
The change was introduced in 5.6. After the refactoring, 14960f52,
in 5.7 branch and a merge, it is not needed any more.
Conflicts:
.qmake.conf
src/corelib/io/qstandardpaths_mac.mm
src/corelib/tools/qsharedpointer_impl.h
tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling_p.h | 21 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 5 |
6 files changed, 31 insertions, 6 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ce9d1cbe45..0d34016dff 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3576,6 +3576,7 @@ static inline void formatTouchEvent(QDebug d, const QTouchEvent &t) { d << "QTouchEvent("; QtDebugUtils::formatQEnum(d, t.type()); + d << " device: " << t.device()->name(); d << " states: "; QtDebugUtils::formatQFlags(d, t.touchPointStates()); d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')'; diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 50fb4d73ea..60e8dcf562 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -53,6 +53,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qmargins.h> +#include <QtCore/qmath.h> #include <QtCore/qrect.h> #include <QtCore/qvector.h> #include <QtCore/qloggingcategory.h> @@ -389,6 +390,24 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow * return pointRegion; } +// When mapping expose events to Qt rects: round top/left towards the origin and +// bottom/right away from the origin, making sure that we cover the whole window. +inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QWindow *window) +{ + if (!QHighDpiScaling::isActive()) + return pixelRegion; + + const qreal scaleFactor = QHighDpiScaling::factor(window); + QRegion pointRegion; + foreach (const QRect &rect, pixelRegion.rects()) { + const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor; + const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor; + pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())), + QPoint(qCeil(bottomRightP.x()), qCeil(bottomRightP.y()))); + } + return pointRegion; +} + inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window) { if (!QHighDpiScaling::isActive()) @@ -506,6 +525,8 @@ namespace QHighDpi { template <typename T> inline T fromNativeLocalRegion(const T &value, ...) { return value; } template <typename T> inline + T fromNativeLocalExposedRegion(const T &value, ...) { return value; } + template <typename T> inline T toNativeLocalRegion(const T &value, ...) { return value; } template <typename T> inline diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index b3c7fe957d..56eb6f0e12 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -60,7 +60,7 @@ #include <QtGui/qopengl.h> #include <QtGui/qopenglversionfunctions.h> -#if QT_DEPRECATED_SINCE(5, 5) +#if QT_DEPRECATED_SINCE(5, 6) #include <QtCore/qhash.h> #endif #include <QtCore/qhashfunctions.h> diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index abbd1fe999..769d30888b 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -490,8 +490,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co { QPlatformScreen *currentScreen = screen(); QPlatformScreen *fallback = currentScreen; - //QRect::center can return a value outside the rectangle if it's empty - const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center(); + // QRect::center can return a value outside the rectangle if it's empty. + // Apply mapToGlobal() in case it is a foreign/embedded window. + const QPoint center = + mapToGlobal(newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center()); if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) { const auto screens = currentScreen->virtualSiblings(); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 0c7e0e5816..44fa88e7cf 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -375,7 +375,7 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate) { Q_Q(QWindow); if (parentWindow) { - qWarning() << this << '(' << newScreen << "): Attempt to set a screen on a child window."; + qWarning() << q << '(' << newScreen << "): Attempt to set a screen on a child window."; return; } if (newScreen != topLevelScreen) { diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 2489974bb3..c76721f89b 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -588,7 +588,8 @@ void QWindowSystemInterface::handleThemeChange(QWindow *tlw) void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion ®ion) { - QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalRegion(region, tlw)); + QWindowSystemInterfacePrivate::ExposeEvent *e = + new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw)); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } @@ -874,7 +875,7 @@ Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::Keybo QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } -Q_GUI_EXPORT bool qt_handleShortcutEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1) +Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1) { #ifndef QT_NO_SHORTCUT |