summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qcursor.h8
-rw-r--r--src/gui/kernel/qevent.cpp82
-rw-r--r--src/gui/kernel/qevent.h9
-rw-r--r--src/gui/kernel/qguiapplication.cpp75
-rw-r--r--src/gui/kernel/qguiapplication.h3
-rw-r--r--src/gui/kernel/qguiapplication_p.h5
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h6
-rw-r--r--src/gui/kernel/qopenglcontext.cpp44
-rw-r--r--src/gui/kernel/qopenglcontext.h6
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qopenglwindow.cpp5
-rw-r--r--src/gui/kernel/qplatformintegration.cpp6
-rw-r--r--src/gui/kernel/qplatformmenu.h1
-rw-r--r--src/gui/kernel/qplatformopenglcontext.cpp7
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h2
-rw-r--r--src/gui/kernel/qplatformtheme.h1
-rw-r--r--src/gui/kernel/qplatformwindow.cpp5
-rw-r--r--src/gui/kernel/qrasterwindow.cpp5
-rw-r--r--src/gui/kernel/qsessionmanager.cpp19
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp72
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h10
-rw-r--r--src/gui/kernel/qstylehints.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp48
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h3
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h4
26 files changed, 275 insertions, 163 deletions
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 1b11bad69f..814e8ab7bd 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -87,9 +87,12 @@ public:
QCursor &operator=(const QCursor &cursor);
#ifdef Q_COMPILER_RVALUE_REFS
QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
- inline QCursor &operator=(QCursor &&other)
- { qSwap(d, other.d); return *this; }
+ inline QCursor &operator=(QCursor &&other) Q_DECL_NOTHROW
+ { swap(other); return *this; }
#endif
+
+ void swap(QCursor &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
+
operator QVariant() const;
Qt::CursorShape shape() const;
@@ -110,6 +113,7 @@ public:
private:
QCursorData *d;
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QCursor)
/*****************************************************************************
QCursor stream functions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 34387d95d8..2b3b153537 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -702,6 +702,31 @@ QHoverEvent::~QHoverEvent()
*/
/*!
+ \fn bool QWheelEvent::inverted() const
+ \since 5.7
+
+ Returns whether the delta values delivered with the event are inverted.
+
+ Normally, a vertical wheel will produce a QWheelEvent with positive delta
+ values if the top of the wheel is rotating away from the hand operating it.
+ Similarly, a horizontal wheel movement will produce a QWheelEvent with
+ positive delta values if the top of the wheel is moved to the left.
+
+ However, on some platforms this is configurable, so that the same
+ operations described above will produce negative delta values (but with the
+ same magnitude). With the inverted property a wheel event consumer can
+ choose to always follow the direction of the wheel, regardless of the
+ system settings, but only for specific widgets. (One such use case could be
+ that the user is rotating the wheel in the same direction as a visual
+ Tumbler rotates. Another usecase is to make a slider handle follow the
+ direction of movement of fingers on a touchpad regardless of system
+ configuration.)
+
+ \note Many platforms provide no such information. On such platforms
+ \l inverted always returns false.
+*/
+
+/*!
\fn Qt::Orientation QWheelEvent::orientation() const
\obsolete
@@ -734,7 +759,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient)
: QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
- ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized)
+ ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
{
g = QCursor::pos();
if (orient == Qt::Vertical)
@@ -769,7 +794,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
- ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized)
+ ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
{
if (orient == Qt::Vertical)
angleD = QPoint(0, delta);
@@ -806,7 +831,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
- src(Qt::MouseEventNotSynthesized)
+ src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
{}
/*!
@@ -837,15 +862,14 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase),
- src(Qt::MouseEventNotSynthesized)
+ src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
{}
/*!
Constructs a wheel event object.
- The \a pos provides the location of the mouse cursor
- within the window. The position in global coordinates is specified
- by \a globalPos.
+ The \a pos provides the location of the mouse cursor within the window. The
+ position in global coordinates is specified by \a globalPos.
\a pixelDelta contains the scrolling distance in pixels on screen, while
\a angleDelta contains the wheel rotation distance. \a pixelDelta is
@@ -873,7 +897,49 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source)
+ angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),
+ invertedScrolling(false)
+{}
+
+/*!
+ Constructs a wheel event object.
+
+ The \a pos provides the location of the mouse cursor
+ within the window. The position in global coordinates is specified
+ by \a globalPos.
+
+ \a pixelDelta contains the scrolling distance in pixels on screen, while
+ \a angleDelta contains the wheel rotation distance. \a pixelDelta is
+ optional and can be null.
+
+ The mouse and keyboard states at the time of the event are specified by
+ \a buttons and \a modifiers.
+
+ For backwards compatibility, the event can also hold monodirectional wheel
+ event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the
+ direction.
+
+ The scrolling phase of the event is specified by \a phase.
+
+ If the wheel event comes from a physical mouse wheel, \a source is set to
+ Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the
+ operating system, or from a non-mouse hardware device, such that \a
+ pixelDelta is directly related to finger movement, \a source is set to
+ Qt::MouseEventSynthesizedBySystem. If it comes from Qt, source would be set
+ to Qt::MouseEventSynthesizedByQt.
+
+ If the system is configured to invert the delta values delivered with the
+ event (such as natural scrolling of the touchpad on OS X), \a inverted
+ should be \c true. Otherwise, \a inverted is \c false
+
+ \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase()
+*/
+QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
+ QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted)
+ : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
+ angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),
+ invertedScrolling(inverted)
{}
#endif // QT_NO_WHEELEVENT
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 2f31566b23..1c42c61e85 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -187,6 +187,9 @@ public:
QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source);
+ QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
+ int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted);
~QWheelEvent();
@@ -210,6 +213,7 @@ public:
inline Qt::MouseButtons buttons() const { return mouseState; }
inline Qt::ScrollPhase phase() const { return Qt::ScrollPhase(ph); }
+ inline bool inverted() const { return invertedScrolling; }
Qt::MouseEventSource source() const { return Qt::MouseEventSource(src); }
@@ -223,7 +227,8 @@ protected:
Qt::MouseButtons mouseState;
uint ph : 2;
uint src: 2;
- int reserved : 28;
+ bool invertedScrolling : 1;
+ int reserved : 27;
friend class QApplication;
};
@@ -576,8 +581,10 @@ private:
Qt::InputMethodQuery query;
QVariant value;
};
+ friend QTypeInfo<QueryPair>;
QVector<QueryPair> m_values;
};
+Q_DECLARE_TYPEINFO(QInputMethodQueryEvent::QueryPair, Q_MOVABLE_TYPE);
#endif // QT_NO_INPUTMETHOD
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index e4d7ad8fcd..31b30c6e5a 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -146,6 +146,10 @@ QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
QList<QObject *> QGuiApplicationPrivate::generic_plugin_list;
+#ifndef QT_NO_SESSIONMANAGER
+bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true;
+#endif
+
enum ApplicationResourceFlags
{
ApplicationPaletteExplicitlySet = 0x1,
@@ -583,7 +587,7 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
: QCoreApplication(p)
{
- d_func()->init(); }
+}
/*!
Destructs the application.
@@ -1296,6 +1300,8 @@ void QGuiApplicationPrivate::eventDispatcherReady()
void QGuiApplicationPrivate::init()
{
+ QCoreApplicationPrivate::init();
+
QCoreApplicationPrivate::is_app_running = false; // Starting up.
bool loadTestability = false;
@@ -1437,7 +1443,7 @@ void QGuiApplicationPrivate::init()
typedef void (*TasInitialize)(void);
TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
if (Q_UNLIKELY(!initFunction)) {
- qCritical() << "Library qttestability resolve failed!";
+ qCritical("Library qttestability resolve failed!");
} else {
initFunction();
}
@@ -1595,7 +1601,7 @@ QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function)
{
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
if (!pi) {
- qWarning() << "QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function";
+ qWarning("QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function");
return Q_NULLPTR;
}
@@ -1974,7 +1980,8 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
return;
}
- QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers, e->phase, e->source);
+ QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation,
+ buttons, e->modifiers, e->phase, e->source, e->inverted);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev);
#endif /* ifndef QT_NO_WHEELEVENT */
@@ -3136,6 +3143,57 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo
emit qApp->applicationStateChanged(applicationState);
}
+#ifndef QT_NO_SESSIONMANAGER
+// ### Qt6: consider removing the feature or making it less intrusive
+/*!
+ \since 5.6
+
+ Returns whether QGuiApplication will use fallback session management.
+
+ The default is \c true.
+
+ If this is \c true and the session manager allows user interaction,
+ QGuiApplication will try to close toplevel windows after
+ commitDataRequest() has been emitted. If a window cannot be closed, session
+ shutdown will be canceled and the application will keep running.
+
+ Fallback session management only benefits applications that have an
+ "are you sure you want to close this window?" feature or other logic that
+ prevents closing a toplevel window depending on certain conditions, and
+ that do nothing to explicitly implement session management. In applications
+ that \e do implement session management using the proper session management
+ API, fallback session management interferes and may break session
+ management logic.
+
+ \warning If all windows \e are closed due to fallback session management
+ and quitOnLastWindowClosed() is \c true, the application will quit before
+ it is explicitly instructed to quit through the platform's session
+ management protocol. That violation of protocol may prevent the platform
+ session manager from saving application state.
+
+ \sa setFallbackSessionManagementEnabled(),
+ QSessionManager::allowsInteraction(), saveStateRequest(),
+ commitDataRequest(), {Session Management}
+*/
+bool QGuiApplication::isFallbackSessionManagementEnabled()
+{
+ return QGuiApplicationPrivate::is_fallback_session_management_enabled;
+}
+
+/*!
+ \since 5.6
+
+ Sets whether QGuiApplication will use fallback session management to
+ \a enabled.
+
+ \sa isFallbackSessionManagementEnabled()
+*/
+void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled)
+{
+ QGuiApplicationPrivate::is_fallback_session_management_enabled = enabled;
+}
+#endif // QT_NO_SESSIONMANAGER
+
/*!
\since 4.2
\fn void QGuiApplication::commitDataRequest(QSessionManager &manager)
@@ -3160,7 +3218,8 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo
\note You should use Qt::DirectConnection when connecting to this signal.
- \sa isSessionRestored(), sessionId(), saveStateRequest(), {Session Management}
+ \sa setFallbackSessionManagementEnabled(), isSessionRestored(),
+ sessionId(), saveStateRequest(), {Session Management}
*/
/*!
@@ -3290,9 +3349,13 @@ void QGuiApplicationPrivate::commitData()
{
Q_Q(QGuiApplication);
is_saving_session = true;
+
emit q->commitDataRequest(*session_manager);
- if (session_manager->allowsInteraction() && !tryCloseAllWindows())
+ if (is_fallback_session_management_enabled && session_manager->allowsInteraction()
+ && !tryCloseAllWindows()) {
session_manager->cancel();
+ }
+
is_saving_session = false;
}
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 95e1b85809..10057c5b7f 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -162,6 +162,9 @@ public:
QString sessionId() const;
QString sessionKey() const;
bool isSavingSession() const;
+
+ static bool isFallbackSessionManagementEnabled();
+ static void setFallbackSessionManagementEnabled(bool);
#endif
static void sync();
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index e7c0501521..a028441a2f 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -81,6 +81,8 @@ public:
QGuiApplicationPrivate(int &argc, char **argv, int flags);
~QGuiApplicationPrivate();
+ void init();
+
void createPlatformIntegration();
void createEventDispatcher() Q_DECL_OVERRIDE;
void eventDispatcherReady() Q_DECL_OVERRIDE;
@@ -248,6 +250,7 @@ public:
#endif
#ifndef QT_NO_SESSIONMANAGER
+ static bool is_fallback_session_management_enabled;
QSessionManager *session_manager;
bool is_session_restored;
bool is_saving_session;
@@ -309,8 +312,6 @@ protected:
private:
friend class QDragManager;
- void init();
-
static QGuiApplicationPrivate *self;
static QTouchDevice *m_fakeTouchDevice;
static int m_fakeMouseSourcePointId;
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index a871fe0024..e790e3094f 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -472,8 +472,9 @@ QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window
QVector<T> pointValues;
pointValues.reserve(pixelValues.size());
+ const auto factor = QHighDpiScaling::factor(window);
for (const T &pixelValue : pixelValues)
- pointValues.append(pixelValue / QHighDpiScaling::factor(window));
+ pointValues.append(pixelValue / factor);
return pointValues;
}
@@ -486,8 +487,9 @@ QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
QVector<T> pixelValues;
pixelValues.reserve(pointValues.size());
+ const auto factor = QHighDpiScaling::factor(window);
for (const T &pointValue : pointValues)
- pixelValues.append(pointValue * QHighDpiScaling::factor(window));
+ pixelValues.append(pointValue * factor);
return pixelValues;
}
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index b45396ab3c..81c0971ea0 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -661,8 +661,6 @@ void QOpenGLContext::destroy()
d->externalVersionFunctions.clear();
qDeleteAll(d->versionFunctions);
d->versionFunctions.clear();
- qDeleteAll(d->versionFunctionsBackend);
- d->versionFunctionsBackend.clear();
delete d->textureFunctions;
d->textureFunctions = 0;
@@ -1035,19 +1033,19 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
return;
if (!surface) {
- qWarning() << "QOpenGLContext::swapBuffers() called with null argument";
+ qWarning("QOpenGLContext::swapBuffers() called with null argument");
return;
}
if (!surface->supportsOpenGL()) {
- qWarning() << "QOpenGLContext::swapBuffers() called with non-opengl surface";
+ qWarning("QOpenGLContext::swapBuffers() called with non-opengl surface");
return;
}
if (surface->surfaceClass() == QSurface::Window
&& !qt_window_private(static_cast<QWindow *>(surface))->receivedExpose)
{
- qWarning() << "QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined";
+ qWarning("QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined");
}
QPlatformSurface *surfaceHandle = surface->surfaceHandle();
@@ -1056,7 +1054,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
#if !defined(QT_NO_DEBUG)
if (!QOpenGLContextPrivate::toggleMakeCurrentTracker(this, false))
- qWarning() << "QOpenGLContext::swapBuffers() called without corresponding makeCurrent()";
+ qWarning("QOpenGLContext::swapBuffers() called without corresponding makeCurrent()");
#endif
if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer)
functions()->glFlush();
@@ -1070,9 +1068,18 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
*/
QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) const
{
+ return getProcAddress(procName.constData());
+}
+
+/*!
+ \overload
+ \since 5.8
+ */
+QFunctionPointer QOpenGLContext::getProcAddress(const char *procName) const
+{
Q_D(const QOpenGLContext);
if (!d->platformGLContext)
- return 0;
+ return nullptr;
return d->platformGLContext->getProcAddress(procName);
}
@@ -1293,29 +1300,10 @@ QOpenGLContext *QOpenGLContext::globalShareContext()
/*!
\internal
*/
-QOpenGLVersionFunctionsBackend *QOpenGLContext::functionsBackend(const QOpenGLVersionStatus &v) const
+QOpenGLVersionFunctionsStorage *QOpenGLContext::functionsBackendStorage() const
{
Q_D(const QOpenGLContext);
- return d->versionFunctionsBackend.value(v, 0);
-}
-
-/*!
- \internal
-*/
-void QOpenGLContext::insertFunctionsBackend(const QOpenGLVersionStatus &v,
- QOpenGLVersionFunctionsBackend *backend)
-{
- Q_D(QOpenGLContext);
- d->versionFunctionsBackend.insert(v, backend);
-}
-
-/*!
- \internal
-*/
-void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
-{
- Q_D(QOpenGLContext);
- d->versionFunctionsBackend.remove(v);
+ return &d->versionFunctionsStorage;
}
/*!
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 56eb6f0e12..33e3f1c3f6 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -174,6 +174,7 @@ public:
void swapBuffers(QSurface *surface);
QFunctionPointer getProcAddress(const QByteArray &procName) const;
+ QFunctionPointer getProcAddress(const char *procName) const;
QSurface *surface() const;
@@ -236,10 +237,7 @@ private:
void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
void deleteQGLContext();
- QOpenGLVersionFunctionsBackend* functionsBackend(const QOpenGLVersionStatus &v) const;
- void insertFunctionsBackend(const QOpenGLVersionStatus &v,
- QOpenGLVersionFunctionsBackend *backend);
- void removeFunctionsBackend(const QOpenGLVersionStatus &v);
+ QOpenGLVersionFunctionsStorage* functionsBackendStorage() const;
void insertExternalFunctions(QAbstractOpenGLFunctions *f);
void removeExternalFunctions(QAbstractOpenGLFunctions *f);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 7fc922f388..4a5fbab364 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -222,7 +222,7 @@ public:
}
mutable QHash<QOpenGLVersionProfile, QAbstractOpenGLFunctions *> versionFunctions;
- mutable QHash<QOpenGLVersionStatus, QOpenGLVersionFunctionsBackend *> versionFunctionsBackend;
+ mutable QOpenGLVersionFunctionsStorage versionFunctionsStorage;
mutable QSet<QAbstractOpenGLFunctions *> externalVersionFunctions;
void *qGLContextHandle;
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 37db608430..8ab5c08442 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -252,9 +252,10 @@ void QOpenGLWindowPrivate::beginPaint(const QRegion &region)
if (!fbo || fbo->size() != deviceSize) {
QOpenGLFramebufferObjectFormat fboFormat;
fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- if (q->requestedFormat().samples() > 0) {
+ const int samples = q->requestedFormat().samples();
+ if (samples > 0) {
if (updateBehavior != QOpenGLWindow::PartialUpdateBlend)
- fboFormat.setSamples(q->requestedFormat().samples());
+ fboFormat.setSamples(samples);
else
qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling");
}
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 06e41f7364..a0e65654a6 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -224,7 +224,8 @@ QPlatformServices *QPlatformIntegration::services() const
platforms where no window management is available, meaning for example that windows
are never repositioned by the window manager. The default implementation returns \c true.
- \value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is
+ \value AllGLFunctionsQueryable Deprecated. Used to indicate whether the QOpenGLContext
+ backend provided by the platform is
able to return function pointers from getProcAddress() even for standard OpenGL
functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is
important because the OpenGL specifications do not require this ability from the
@@ -232,7 +233,8 @@ QPlatformServices *QPlatformIntegration::services() const
platform plugins may however choose to enhance the behavior in the backend
implementation for QOpenGLContext::getProcAddress() and support returning a function
pointer also for the standard, non-extension functions. This capability is a
- prerequisite for dynamic OpenGL loading.
+ prerequisite for dynamic OpenGL loading. Starting with Qt 5.7, the platform plugin
+ is required to have this capability.
\value ApplicationIcon The platform supports setting the application icon. (since 5.5)
*/
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 22848fcff6..bd4f4d9beb 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -148,6 +148,7 @@ public:
virtual void handleReparent(QWindow *newParentWindow) = 0;
virtual QPlatformMenu *menuForTag(quintptr tag) const = 0;
+ virtual QPlatformMenu *createMenu() const { return nullptr; }
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp
index 2457a5237d..07b5a0dda6 100644
--- a/src/gui/kernel/qplatformopenglcontext.cpp
+++ b/src/gui/kernel/qplatformopenglcontext.cpp
@@ -71,10 +71,11 @@ QT_BEGIN_NAMESPACE
The implementation must support being called in a thread different than the gui-thread.
*/
-/*! \fn QFunctionPointer QPlatformOpenGLContext::getProcAddress(const QByteArray &procName)
- Reimplement in subclass to native getProcAddr calls.
+/*! \fn QFunctionPointer QPlatformOpenGLContext::getProcAddress(const char *procName)
- Note: its convenient to use qPrintable(const QString &str) to get the const char * pointer
+ Reimplement in subclass to allow dynamic querying of OpenGL symbols. As opposed to e.g. the wglGetProcAddress
+ function on Windows, Qt expects this methods to be able to return valid function pointers even for standard
+ OpenGL symbols.
*/
class QPlatformOpenGLContextPrivate
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h
index f2ec1c1a7e..1a38a5fed3 100644
--- a/src/gui/kernel/qplatformopenglcontext.h
+++ b/src/gui/kernel/qplatformopenglcontext.h
@@ -83,7 +83,7 @@ public:
virtual bool isSharing() const { return false; }
virtual bool isValid() const { return true; }
- virtual QFunctionPointer getProcAddress(const QByteArray &procName) = 0;
+ virtual QFunctionPointer getProcAddress(const char *procName) = 0;
QOpenGLContext *context() const;
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 77e063f889..c4c7482995 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -172,6 +172,7 @@ public:
FixedFont,
GroupBoxTitleFont,
TabButtonFont,
+ EditorFont,
NFonts
};
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 347d02d616..e45a1d61ba 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -499,9 +499,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
const auto screens = currentScreen->virtualSiblings();
for (QPlatformScreen *screen : screens) {
- if (screen->geometry().contains(center))
+ const QRect screenGeometry = screen->geometry();
+ if (screenGeometry.contains(center))
return screen;
- if (screen->geometry().intersects(newGeometry))
+ if (screenGeometry.intersects(newGeometry))
fallback = screen;
}
}
diff --git a/src/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp
index 947f2bb6a8..d8d448249e 100644
--- a/src/gui/kernel/qrasterwindow.cpp
+++ b/src/gui/kernel/qrasterwindow.cpp
@@ -73,8 +73,9 @@ public:
void beginPaint(const QRegion &region) Q_DECL_OVERRIDE
{
Q_Q(QRasterWindow);
- if (backingstore->size() != q->size()) {
- backingstore->resize(q->size());
+ const QSize size = q->size();
+ if (backingstore->size() != size) {
+ backingstore->resize(size);
markWindowAsDirty();
}
backingstore->beginPaint(region);
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index f7414868d9..493a321c74 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -70,22 +70,21 @@ QT_BEGIN_NAMESPACE
settings.
QSessionManager provides an interface between the application and the
- session manager so that the program can work well with the session manager.
- In Qt, session management requests for action are handled by the two
- signals QGuiApplication::commitDataRequest() and
- QGuiApplication::saveStateRequest(). Both provide a reference to a session
- manager object as argument, to allow the application to communicate with
- the session manager. The session manager can only be accessed through these
- functions.
+ platform's session manager. In Qt, session management requests for action
+ are handled by the two signals QGuiApplication::commitDataRequest() and
+ QGuiApplication::saveStateRequest(). Both provide a reference to a
+ QSessionManager object as argument. The session manager can only be
+ accessed in slots invoked by these signals.
+
+ \warning If you use QSessionManager, you should disable fallback session
+ management: QGuiApplication::setFallbackSessionManagementEnabled().
No user interaction is possible \e unless the application gets explicit
permission from the session manager. You ask for permission by calling
allowsInteraction() or, if it is really urgent, allowsErrorInteraction().
Qt does not enforce this, but the session manager may.
- You can try to abort the shutdown process by calling cancel(). The default
- commitData() function does this if some top-level window rejected its
- closeEvent().
+ You can try to abort the shutdown process by calling cancel().
For sophisticated session managers provided on Unix/X11, QSessionManager
offers further possibilities to fine-tune an application's session
diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp
index 2cfbc4caa4..40bf15b807 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow.cpp
+++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp
@@ -48,52 +48,31 @@
QT_BEGIN_NAMESPACE
QShapedPixmapWindow::QShapedPixmapWindow(QScreen *screen)
- : QWindow(screen),
- m_backingStore(0),
- m_useCompositing(true)
+ : m_useCompositing(true)
{
+ setScreen(screen);
QSurfaceFormat format;
format.setAlphaBufferSize(8);
setFormat(format);
- setSurfaceType(RasterSurface);
- setFlags(Qt::ToolTip | Qt::FramelessWindowHint |
- Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus);
- create();
- m_backingStore = new QBackingStore(this);
+ setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint
+ | Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus);
}
QShapedPixmapWindow::~QShapedPixmapWindow()
{
- delete m_backingStore;
- m_backingStore = 0;
-}
-
-void QShapedPixmapWindow::render()
-{
- QRect rect(QPoint(), geometry().size());
-
- m_backingStore->beginPaint(rect);
-
- QPaintDevice *device = m_backingStore->paintDevice();
-
- {
- QPainter p(device);
- if (m_useCompositing)
- p.setCompositionMode(QPainter::CompositionMode_Source);
- else
- p.fillRect(rect, QGuiApplication::palette().base());
- p.drawPixmap(0, 0, m_pixmap);
- }
-
- m_backingStore->endPaint();
- m_backingStore->flush(rect);
}
void QShapedPixmapWindow::setPixmap(const QPixmap &pixmap)
{
m_pixmap = pixmap;
- if (!m_useCompositing)
- setMask(m_pixmap.mask());
+ if (!m_useCompositing) {
+ const QBitmap mask = m_pixmap.mask();
+ if (!mask.isNull()) {
+ if (!handle())
+ create();
+ setMask(mask);
+ }
+ }
}
void QShapedPixmapWindow::setHotspot(const QPoint &hotspot)
@@ -101,19 +80,28 @@ void QShapedPixmapWindow::setHotspot(const QPoint &hotspot)
m_hotSpot = hotspot;
}
-void QShapedPixmapWindow::updateGeometry(const QPoint &pos)
+void QShapedPixmapWindow::paintEvent(QPaintEvent *)
{
- if (m_pixmap.isNull())
- m_backingStore->resize(QSize(1,1));
- else if (m_backingStore->size() != m_pixmap.size())
- m_backingStore->resize(m_pixmap.size());
-
- setGeometry(QRect(pos - m_hotSpot, m_backingStore->size()));
+ if (!m_pixmap.isNull()) {
+ const QRect rect(QPoint(0, 0), size());
+ QPainter painter(this);
+ if (m_useCompositing)
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ else
+ painter.fillRect(rect, QGuiApplication::palette().base());
+ painter.drawPixmap(rect, m_pixmap);
+ }
}
-void QShapedPixmapWindow::exposeEvent(QExposeEvent *)
+void QShapedPixmapWindow::updateGeometry(const QPoint &pos)
{
- render();
+ QSize size(1, 1);
+ if (!m_pixmap.isNull()) {
+ size = qFuzzyCompare(m_pixmap.devicePixelRatio(), 1.0)
+ ? m_pixmap.size()
+ : (QSizeF(m_pixmap.size()) / m_pixmap.devicePixelRatio()).toSize();
+ }
+ setGeometry(QRect(pos - m_hotSpot, size));
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index 65a4e3cfa7..21cecba9e8 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -51,21 +51,18 @@
// We mean it.
//
-#include <QtGui/QWindow>
+#include <QtGui/QRasterWindow>
#include <QtGui/QPixmap>
-#include <QtGui/QBackingStore>
QT_BEGIN_NAMESPACE
-class QShapedPixmapWindow : public QWindow
+class QShapedPixmapWindow : public QRasterWindow
{
Q_OBJECT
public:
explicit QShapedPixmapWindow(QScreen *screen = 0);
~QShapedPixmapWindow();
- void render();
-
void setUseCompositing(bool on) { m_useCompositing = on; }
void setPixmap(const QPixmap &pixmap);
void setHotspot(const QPoint &hotspot);
@@ -73,10 +70,9 @@ public:
void updateGeometry(const QPoint &pos);
protected:
- void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
private:
- QBackingStore *m_backingStore;
QPixmap m_pixmap;
QPoint m_hotSpot;
bool m_useCompositing;
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index e184fed275..ecc2886a04 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -54,7 +54,7 @@ static inline QVariant themeableHint(QPlatformTheme::ThemeHint th,
QPlatformIntegration::StyleHint ih)
{
if (!QCoreApplication::instance()) {
- qWarning() << "Must construct a QGuiApplication before accessing a platform theme hint.";
+ qWarning("Must construct a QGuiApplication before accessing a platform theme hint.");
return QVariant();
}
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index f43ef43c6c..107ea73a56 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1145,7 +1145,7 @@ qreal QWindow::devicePixelRatio() const
void QWindow::setWindowState(Qt::WindowState state)
{
if (state == Qt::WindowActive) {
- qWarning() << "QWindow::setWindowState does not accept Qt::WindowActive";
+ qWarning("QWindow::setWindowState does not accept Qt::WindowActive");
return;
}
@@ -1469,9 +1469,9 @@ void QWindow::setGeometry(const QRect &rect)
{
Q_D(QWindow);
d->positionAutomatic = false;
- if (rect == geometry())
+ const QRect oldRect = geometry();
+ if (rect == oldRect)
return;
- QRect oldRect = geometry();
d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
if (d->platformWindow) {
@@ -2436,7 +2436,7 @@ QWindow *QWindowPrivate::topLevelWindow() const
QWindow *QWindow::fromWinId(WId id)
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ForeignWindows)) {
- qWarning() << "QWindow::fromWinId(): platform plugin does not support foreign windows.";
+ qWarning("QWindow::fromWinId(): platform plugin does not support foreign windows.");
return 0;
}
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 39bc161a7c..5b91f1bc7e 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -315,7 +315,8 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local,
handleWheelEvent(w, time, local, global, pixelDelta, angleDelta, mods, phase, source);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
+void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
+ Qt::MouseEventSource source, bool invertedScrolling)
{
// Qt 4 sends two separate wheel events for horizontal and vertical
// deltas. For Qt 5 we want to send the deltas in one event, but at the
@@ -333,14 +334,15 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
// Simple case: vertical deltas only:
if (angleDelta.y() != 0 && angleDelta.x() == 0) {
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical,
+ mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
}
// Simple case: horizontal deltas only:
if (angleDelta.y() == 0 && angleDelta.x() != 0) {
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
}
@@ -348,12 +350,12 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
// Both horizontal and vertical deltas: Send two wheel events.
// The first event contains the Qt 5 pixel and angle delta as points,
// and in addition the Qt 4 compatibility vertical angle delta.
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
// The second event contains null pixel and angle points and the
// Qt 4 compatibility horizontal angle delta.
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, QHighDpi::fromNativeLocalPosition(local, tlw), QHighDpi::fromNativePixels(global, tlw), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
@@ -863,7 +865,9 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QP
{
bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- QWindowSystemInterface::handleMouseEvent(w, timestamp, local, global, b, mods);
+ const qreal factor = QHighDpiScaling::factor(w);
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, local * factor,
+ global * factor, b, mods);
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
}
@@ -912,36 +916,14 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int
#endif
}
-static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
-{
- QWindowSystemInterface::TouchPoint p;
- p.id = pt.id();
- p.flags = pt.flags();
- p.normalPosition = pt.normalizedPos();
- p.area = pt.screenRect();
- p.pressure = pt.pressure();
- p.state = pt.state();
- p.velocity = pt.velocity();
- p.rawPositions = pt.rawScreenPositions();
- return p;
-}
-static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
-{
- QList<struct QWindowSystemInterface::TouchPoint> newList;
- newList.reserve(pointList.size());
- for (const QTouchEvent::TouchPoint &p : pointList)
- newList.append(touchPoint(p));
-
- return newList;
-}
-
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)
{
bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods);
+ QWindowSystemInterface::handleTouchEvent(w, device,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods);
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
}
@@ -956,5 +938,11 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS
return true;
}
+QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD,
+ QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted)
+ : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D),
+ qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted)
+{
+}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 66a4afb085..eff3986788 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -109,7 +109,8 @@ public:
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
- Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized,
+ bool inverted = false);
// Wheel event compatibility functions. Will be removed: do not use.
static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 523aa984a9..3ccf815c54 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -242,8 +242,7 @@ public:
class WheelEvent : public InputEvent {
public:
WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
- Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
- : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src) { }
+ Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool inverted = false);
QPoint pixelDelta;
QPoint angleDelta;
int qt4Delta;
@@ -252,6 +251,7 @@ public:
QPointF globalPos;
Qt::ScrollPhase phase;
Qt::MouseEventSource source;
+ bool inverted;
};
class KeyEvent : public InputEvent {