7@implementation QNSView (Touch)
9- (
bool)shouldSendSingleTouch
11 if (!m_platformWindow)
16 return m_platformWindow->window()->inherits(
"QWidgetWindow");
19- (
void)touchesBeganWithEvent:(NSEvent *)event
21 if (!m_platformWindow)
24 const NSTimeInterval timestamp = [event timestamp];
25 const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
26 qCDebug(lcQpaTouch) <<
"touchesBeganWithEvent" << points <<
"from device" << Qt::hex << [event deviceID];
27 QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
28 m_platformWindow->window(), timestamp * 1000,
29 QCocoaTouch::getTouchDevice(QInputDevice::DeviceType::TouchPad, [event deviceID]),
33- (
void)touchesMovedWithEvent:(NSEvent *)event
35 if (!m_platformWindow)
38 const NSTimeInterval timestamp = [event timestamp];
40 QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
41 nativeDrag->setLastInputEvent(event, self);
43 const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
44 qCDebug(lcQpaTouch) <<
"touchesMovedWithEvent" << points <<
"from device" << Qt::hex << [event deviceID];
45 QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
46 m_platformWindow->window(), timestamp * 1000,
47 QCocoaTouch::getTouchDevice(QInputDevice::DeviceType::TouchPad, [event deviceID]),
51- (
void)touchesEndedWithEvent:(NSEvent *)event
53 if (!m_platformWindow)
56 const NSTimeInterval timestamp = [event timestamp];
58 QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
59 nativeDrag->setLastInputEvent(event, self);
61 const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
62 qCDebug(lcQpaTouch) <<
"touchesEndedWithEvent" << points <<
"from device" << Qt::hex << [event deviceID];
63 QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
64 m_platformWindow->window(), timestamp * 1000,
65 QCocoaTouch::getTouchDevice(QInputDevice::DeviceType::TouchPad, [event deviceID]),
68 m_platformWindow->updateAllowedTouchTypes();
71- (
void)touchesCancelledWithEvent:(NSEvent *)event
73 if (!m_platformWindow)
76 const NSTimeInterval timestamp = [event timestamp];
78 QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
79 nativeDrag->setLastInputEvent(event, self);
81 const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
82 qCDebug(lcQpaTouch) <<
"touchesCancelledWithEvent" << points <<
"from device" << Qt::hex << [event deviceID];
83 QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
84 m_platformWindow->window(), timestamp * 1000,
85 QCocoaTouch::getTouchDevice(QInputDevice::DeviceType::TouchPad, [event deviceID]),
88 m_platformWindow->updateAllowedTouchTypes();