From 0af3c490d6a8763f54e8fc52ffc077d4940b526e Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 8 Jun 2009 10:26:52 +0200 Subject: Compile on Windows again --- src/gui/graphicsview/qgraphicsscene.cpp | 4 ++- src/gui/graphicsview/qgraphicsview.cpp | 4 ++- src/gui/kernel/qapplication_p.h | 2 +- src/gui/kernel/qapplication_win.cpp | 51 +++++++++++---------------------- 4 files changed, 23 insertions(+), 38 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 2f6c4e1..a92e38c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5693,7 +5693,9 @@ void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, touchPoint.setPos(item->d_ptr->genericMapFromScene(touchPoint.scenePos(), touchEvent->widget())); touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), touchEvent->widget())); touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), touchEvent->widget())); -#warning FIXME +#ifdef Q_CC_GNU +# warning FIXME +#endif // ### touchPoint.setSize(item->d_ptr->genericMapFromScene(touchPoint.sceneSize(), touchEvent->widget())); } touchEvent->setTouchPoints(touchPoints); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index da1837c..e874071 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -314,7 +314,9 @@ void QGraphicsViewPrivate::convertTouchEventToGraphicsSceneTouchEvent(QGraphicsV touchPoint.setScenePos(d->mapToScene(touchPoint.pos())); touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos())); touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos())); -#warning FIXME +#ifdef Q_CC_GNU +# warning FIXME +#endif // ### touchPoint.setSceneSize(d->mapToScene(touchPoint.screenSize())); // screenPos, startScreenPos, lastScreenPos, and screenSize are already set from the diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index d34d4fe..60796fc 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -453,7 +453,7 @@ public: static qt_CloseTouchInputHandlePtr CloseTouchInputHandle; QHash touchInputIDToTouchPointID; - QVector appAllTouchPoints; + QList appAllTouchPoints; bool translateTouchEvent(const MSG &msg); #endif diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 1261a20..4bbec96 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3990,13 +3990,10 @@ void QApplicationPrivate::initializeMultitouch_sys() CloseTouchInputHandle = static_cast(library.resolve("CloseTouchInputHandle")); touchInputIDToTouchPointID.clear(); - appAllTouchPoints.clear(); } void QApplicationPrivate::cleanupMultitouch_sys() { - qDeleteAll(appAllTouchPoints); - appAllTouchPoints.clear(); touchInputIDToTouchPointID.clear(); } @@ -4008,8 +4005,7 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) if (!widgetForHwnd) return false; - Qt::TouchPointStates states = 0; - QList touchPoints; + QList touchPoints; QVector winTouchInputs(msg.wParam); memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * winTouchInputs.count()); @@ -4023,55 +4019,40 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) touchInputIDToTouchPointID.insert(touchInput.dwID, touchPointID); } - if (appAllTouchPoints.count() <= touchPointID) - appAllTouchPoints.resize(touchPointID + 1); - - QTouchEvent::TouchPoint *touchPoint = appAllTouchPoints.at(touchPointID); - if (!touchPoint) - touchPoint = appAllTouchPoints[touchPointID] = new QTouchEvent::TouchPoint(touchPointID); + QTouchEvent::TouchPoint touchPoint(touchPointID); // update state - bool down = touchPoint->state() != Qt::TouchPointReleased; - QPointF screenPos(qreal(touchInput.x) / qreal(100.), qreal(touchInput.y) / qreal(100.)); + bool down = touchPoint.state() != Qt::TouchPointReleased; + QPointF globalPos(qreal(touchInput.x) / qreal(100.), qreal(touchInput.y) / qreal(100.)); QSizeF contactArea = (touchInput.dwMask & TOUCHINPUTMASKF_CONTACTAREA) ? QSizeF(qreal(touchInput.cxContact) / qreal(100.), qreal(touchInput.cyContact) / qreal(100.)) : QSizeF(); if (!down && (touchInput.dwFlags & TOUCHEVENTF_DOWN)) { - touchPoint->setState(Qt::TouchPointPressed); - touchPoint->setScreenPos(screenPos); - touchPoint->setStartScreenPos(screenPos); - touchPoint->setLastScreenPos(screenPos); - touchPoint->setArea(contactArea); - touchPoint->setPressure(qreal(1.)); + touchPoint.setState(Qt::TouchPointPressed); + touchPoint.setGlobalPos(globalPos); + touchPoint.setSize(contactArea); } else if (down && (touchInput.dwFlags & TOUCHEVENTF_UP)) { - touchPoint->setState(Qt::TouchPointReleased); - touchPoint->setLastScreenPos(touchPoint->screenPos()); - touchPoint->setScreenPos(screenPos); - touchPoint->setArea(QSizeF()); - touchPoint->setPressure(qreal(0.)); + touchPoint.setState(Qt::TouchPointReleased); + touchPoint.setGlobalPos(globalPos); + touchPoint.setSize(QSizeF()); } else if (down) { - touchPoint->setState(screenPos == touchPoint->screenPos() + touchPoint.setState(globalPos == touchPoint.globalPos() ? Qt::TouchPointStationary : Qt::TouchPointMoved); - touchPoint->setLastScreenPos(touchPoint->screenPos()); - touchPoint->setScreenPos(screenPos); - touchPoint->setArea(contactArea); + touchPoint.setGlobalPos(globalPos); + touchPoint.setSize(contactArea); // pressure should still be 1. } - states |= touchPoint->state(); touchPoints.append(touchPoint); } QApplicationPrivate::CloseTouchInputHandle((HANDLE) msg.lParam); - QTouchEvent touchEvent(QEvent::RawTouch, - q->keyboardModifiers(), - states, - touchPoints); - return qt_tabletChokeMouse = (QApplication::sendSpontaneousEvent(widgetForHwnd, &touchEvent) - && touchEvent.isAccepted()); + extern bool qt_translateRawTouchEvent(const QList &, QWidget *); + qt_tabletChokeMouse = qt_translateRawTouchEvent(touchPoints, widgetForHwnd); + return qt_tabletChokeMouse; } QT_END_NAMESPACE -- cgit v0.12