summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-08-06 14:19:42 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-08-06 14:19:42 (GMT)
commita3ee22515135a29b17f4b1a9ac56b12ebcf92fcb (patch)
treef4077d39b3eed0acc478f02d0db9b8a1da2f63b8
parentaf44be42cfacb85ef783cdd051f5d106d25c6b50 (diff)
parentc53004694b49d8e4e6c4cfd294efb6589559c2f3 (diff)
downloadQt-a3ee22515135a29b17f4b1a9ac56b12ebcf92fcb.zip
Qt-a3ee22515135a29b17f4b1a9ac56b12ebcf92fcb.tar.gz
Qt-a3ee22515135a29b17f4b1a9ac56b12ebcf92fcb.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm54
-rw-r--r--src/gui/kernel/qevent_p.h10
2 files changed, 51 insertions, 13 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 1d352cb..8c6f394 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -50,6 +50,7 @@
#include <private/qdnd_p.h>
#include <private/qmacinputcontext_p.h>
#include <private/qmultitouch_mac_p.h>
+#include <private/qevent_p.h>
#include <qscrollarea.h>
#include <qhash.h>
@@ -868,32 +869,65 @@ extern "C" {
- (void)magnifyWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "magnifyWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::Zoom;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qNGEvent.percentage = [event magnification];
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)rotateWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "rotateWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::Rotate;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qNGEvent.percentage = [event rotation];
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)swipeWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "swipeWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::Swipe;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qNGEvent.direction = QSize(-[event deltaX], -[event deltaY]);
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)beginGestureWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "beginGestureWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)endGestureWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "endGestureWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qApp->sendEvent(qwidget, &qNGEvent);
}
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 92c4fc1..b21b35c 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -127,11 +127,13 @@ public:
GestureBegin,
GestureEnd,
Pan,
- Pinch
+ Zoom,
+ Rotate,
+ Swipe
};
QNativeGestureEvent()
- : QEvent(QEvent::NativeGesture), gestureType(None)
+ : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0), direction(0, 0)
#ifdef Q_WS_WIN
, sequenceId(0)
#endif
@@ -139,8 +141,10 @@ public:
}
Type gestureType;
-#ifdef Q_WS_WIN
+ float percentage;
QPoint position;
+ QSize direction;
+#ifdef Q_WS_WIN
ulong sequenceId;
#endif
};