From fbee62af06ebe2c8cf6da1cc18a665c69c64eff7 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 3 Aug 2009 15:04:43 +0200 Subject: Renamed internal WinGesture event to NativeGesture. It will also be used on Mac, so it doesn't make sense to keep it windows specific. Reviewed-by: trustme --- src/corelib/kernel/qcoreevent.cpp | 2 +- src/corelib/kernel/qcoreevent.h | 2 +- src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qapplication_win.cpp | 10 +++++----- src/gui/kernel/qevent.cpp | 1 - src/gui/kernel/qevent_p.h | 13 +++++++++++-- src/gui/kernel/qwidget.cpp | 16 ++++++++-------- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index a682fad9..ff00c1c 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -269,7 +269,7 @@ QT_BEGIN_NAMESPACE \omitvalue FutureCallOut \omitvalue CocoaRequestModal \omitvalue Signal - \omitvalue WinGesture + \omitvalue NativeGesture */ /*! diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 1d86f47..d941286 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -276,7 +276,7 @@ public: TouchUpdate = 195, TouchEnd = 196, - WinGesture = 197, + NativeGesture = 197, // Internal for platform gesture support // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index e210556..c24ff49 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4052,7 +4052,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) touchEvent->setAccepted(eventAccepted); break; } - case QEvent::WinGesture: + case QEvent::NativeGesture: { // only propagate the first gesture event (after the GID_BEGIN) QWidget *w = static_cast(receiver); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index d5c820c..3b5c0c3 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3735,7 +3735,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) alienWidget = 0; QWidget *widget = alienWidget ? alienWidget : this; - QWinGestureEvent event; + QNativeGestureEvent event; event.sequenceId = gi.dwSequenceID; event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); if (bResult) { @@ -3744,13 +3744,13 @@ bool QETWidget::translateGestureEvent(const MSG &msg) // we are not interested in this type of event. break; case GID_END: - event.gestureType = QWinGestureEvent::GestureEnd; + event.gestureType = QNativeGestureEvent::GestureEnd; break; case GID_ZOOM: - event.gestureType = QWinGestureEvent::Pinch; + event.gestureType = QNativeGestureEvent::Pinch; break; case GID_PAN: - event.gestureType = QWinGestureEvent::Pan; + event.gestureType = QNativeGestureEvent::Pan; break; case GID_ROTATE: case GID_TWOFINGERTAP: @@ -3758,7 +3758,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) default: break; } - if (event.gestureType != QWinGestureEvent::None) + if (event.gestureType != QNativeGestureEvent::None) qt_sendSpontaneousEvent(widget, &event); } else { DWORD dwErr = GetLastError(); diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index bc3633c..0fc36e7 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -49,7 +49,6 @@ #include "qmime.h" #include "qdnd_p.h" #include "qevent_p.h" -#include "qgesture.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 67441ea..940e587 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -119,7 +119,7 @@ public: qreal pressure; }; -class QWinGestureEvent : public QEvent +class QNativeGestureEvent : public QEvent { public: enum Type { @@ -129,10 +129,19 @@ public: Pinch }; - QWinGestureEvent() : QEvent(QEvent::WinGesture), gestureType(None), sequenceId(0) { } + QNativeGestureEvent() + : QEvent(QEvent::NativeGesture), gestureType(None) +#ifdef Q_WS_WIN + , sequenceId(0) +#endif + { + } + Type gestureType; +#ifdef Q_WS_WIN QPoint position; ulong sequenceId; +#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 43ac37d..5400146 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -7941,8 +7941,8 @@ bool QWidget::event(QEvent *event) break; } #ifdef Q_WS_WIN - case QEvent::WinGesture: { - QWinGestureEvent *ev = static_cast(event); + case QEvent::NativeGesture: { + QNativeGestureEvent *ev = static_cast(event); QApplicationPrivate *qAppPriv = qApp->d_func(); QApplicationPrivate::WidgetStandardGesturesMap::iterator it; it = qAppPriv->widgetGestures.find(this); @@ -7950,15 +7950,15 @@ bool QWidget::event(QEvent *event) Qt::GestureState state = Qt::GestureUpdated; if (qAppPriv->lastGestureId == 0) state = Qt::GestureStarted; - QWinGestureEvent::Type type = ev->gestureType; - if (ev->gestureType == QWinGestureEvent::GestureEnd) { - type = (QWinGestureEvent::Type)qAppPriv->lastGestureId; + QNativeGestureEvent::Type type = ev->gestureType; + if (ev->gestureType == QNativeGestureEvent::GestureEnd) { + type = (QNativeGestureEvent::Type)qAppPriv->lastGestureId; state = Qt::GestureFinished; } QGesture *gesture = 0; switch (type) { - case QWinGestureEvent::Pan: { + case QNativeGestureEvent::Pan: { QPanGesture *pan = it.value().pan; gesture = pan; if (state == Qt::GestureStarted) { @@ -7970,7 +7970,7 @@ bool QWidget::event(QEvent *event) gesture->setPos(ev->position); break; } - case QWinGestureEvent::Pinch: + case QNativeGestureEvent::Pinch: break; default: break; @@ -7984,7 +7984,7 @@ bool QWidget::event(QEvent *event) emit gesture->finished(); event->accept(); } - if (ev->gestureType == QWinGestureEvent::GestureEnd) { + if (ev->gestureType == QNativeGestureEvent::GestureEnd) { qAppPriv->lastGestureId = 0; } else { qAppPriv->lastGestureId = type; -- cgit v0.12