summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-17 10:19:31 +0200
committerLiang Qi <liang.qi@qt.io>2017-10-17 10:34:24 +0200
commitd0a0a3c0418a0fdd2ed84b2a5f7e6565537715c6 (patch)
treed6aeb4d51caf30ccf23eadb806a09295cbf679cd /src/gui/kernel
parent9f405f98a4247cd263b9c5d35659a4ba89e282de (diff)
parentac35f9c44c0fb3b2f40ae5585c497200b2ba743d (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: examples/network/fortuneclient/client.cpp examples/network/fortuneserver/server.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h src/plugins/platforms/cocoa/qcocoabackingstore.h src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoascreen.h src/plugins/platforms/ios/qiosbackingstore.h src/plugins/sqldrivers/oci/qsql_oci.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qevent.cpp20
-rw-r--r--src/gui/kernel/qevent.h3
-rw-r--r--src/gui/kernel/qkeysequence.cpp2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qwindow.cpp24
-rw-r--r--src/gui/kernel/qwindow_p.h4
6 files changed, 43 insertions, 12 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 55339cac8c..8f153fa2d3 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -2763,12 +2763,16 @@ Qt::MouseButtons QTabletEvent::buttons() const
#if QT_DEPRECATED_SINCE(5, 10)
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
- : QInputEvent(QEvent::NativeGesture), mGestureType(type), mTouchDeviceId(255),
+ : QInputEvent(QEvent::NativeGesture), mGestureType(type),
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
mSequenceId(sequenceId), mIntValue(intValue)
{ }
#endif
+typedef QHash<const QNativeGestureEvent*, const QTouchDevice*> NativeGestureEventDataHash;
+// ### Qt6: move this to a member in QNativeGestureEvent
+Q_GLOBAL_STATIC(NativeGestureEventDataHash, g_nativeGestureEventDataHash)
+
/*!
Constructs a native gesture event of type \a type originating from \a device.
@@ -2779,13 +2783,19 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
\a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.
\since 5.10
*/
-QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *device, const QPointF &localPos, const QPointF &windowPos,
+QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
- mTouchDeviceId(QTouchDevicePrivate::get(const_cast<QTouchDevice *>(device))->id),
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
mSequenceId(sequenceId), mIntValue(intValue)
-{ }
+{
+ g_nativeGestureEventDataHash->insert(this, dev);
+}
+
+QNativeGestureEvent::~QNativeGestureEvent()
+{
+ g_nativeGestureEventDataHash->remove(this);
+}
/*!
\since 5.10
@@ -2795,7 +2805,7 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouc
const QTouchDevice *QNativeGestureEvent::device() const
{
- return QTouchDevicePrivate::deviceById(mTouchDeviceId);
+ return g_nativeGestureEventDataHash->value(this);
}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index c3c7e52ece..b3f6d56543 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -307,6 +307,7 @@ public:
#endif
QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument);
+ ~QNativeGestureEvent();
Qt::NativeGestureType gestureType() const { return mGestureType; }
qreal value() const { return mRealValue; }
@@ -322,8 +323,6 @@ public:
protected:
Qt::NativeGestureType mGestureType;
- quint8 mTouchDeviceId; // QTouchDevicePrivate::id
- quint8 mReserved[3]; // if qreal == double clang will pad the QPointF below to a 8-byte boundary
QPointF mLocalPos;
QPointF mWindowPos;
QPointF mScreenPos;
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 9a3d1b0d3a..71ecc46cb6 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -250,7 +250,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
corresponds to the \uicontrol Control keys.
\table
- \header \li StandardKey \li Windows \li \macos \li KDE \li GNOME
+ \header \li StandardKey \li Windows \li \macos \li KDE Plasma \li GNOME
\row \li HelpContents \li F1 \li Ctrl+? \li F1 \li F1
\row \li WhatsThis \li Shift+F1 \li Shift+F1 \li Shift+F1 \li Shift+F1
\row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index c5239af69e..4f2f951d61 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -55,7 +55,7 @@
#ifndef QT_NO_OPENGL
-#include "qopengl.h"
+#include <qopengl.h>
#include "qopenglcontext.h"
#include <private/qobject_p.h>
#include <qmutex.h>
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 5b5c1bd0e3..9969124339 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -45,6 +45,7 @@
#ifndef QT_NO_OPENGL
#include <qpa/qplatformopenglcontext.h>
#include "qopenglcontext.h"
+#include "qopenglcontext_p.h"
#endif
#include "qscreen.h"
@@ -971,6 +972,11 @@ QString QWindow::filePath() const
The window icon might be used by the windowing system for example to
decorate the window, and/or in the task switcher.
+
+ \note On \macos, the window title bar icon is meant for windows representing
+ documents, and will only show up if a file path is also set.
+
+ \sa setFilePath()
*/
void QWindow::setIcon(const QIcon &icon)
{
@@ -983,7 +989,7 @@ void QWindow::setIcon(const QIcon &icon)
}
/*!
- \brief Sets the window's icon in the windowing system
+ \brief Returns the window's icon in the windowing system
\sa setIcon()
*/
@@ -1882,11 +1888,16 @@ void QWindowPrivate::destroy()
QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
QGuiApplication::sendEvent(q, &e);
- delete platformWindow;
+ // Unset platformWindow before deleting, so that the destructor of the
+ // platform window does not recurse back into the platform window via
+ // this window during destruction (e.g. as a result of platform events).
+ QPlatformWindow *pw = platformWindow;
+ platformWindow = nullptr;
+ delete pw;
+
resizeEventPending = true;
receivedExpose = false;
exposed = false;
- platformWindow = 0;
if (wasVisible)
maybeQuitOnLastWindowClosed();
@@ -2623,6 +2634,13 @@ QWindow *QWindowPrivate::topLevelWindow() const
return window;
}
+#if QT_CONFIG(opengl)
+QOpenGLContext *QWindowPrivate::shareContext() const
+{
+ return qt_gl_global_share_context();
+};
+#endif
+
/*!
Creates a local representation of a window created by another process or by
using native libraries below Qt.
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 9b8e2c47e4..2de5aab2c4 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -130,6 +130,10 @@ public:
QWindow *topLevelWindow() const;
+#if QT_CONFIG(opengl)
+ virtual QOpenGLContext *shareContext() const;
+#endif
+
virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; }
virtual void setVisible(bool visible);