iOS: disable Apple Pencil support if configure -no-feature-tabletevent

Task-number: QTBUG-59042
Change-Id: Ia60cb01206316ae85fffac44c453803f39d3a611
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Shawn Rutledge 2017-09-15 11:36:44 +02:00
parent 0d51767b5d
commit d0e93b128d
2 changed files with 14 additions and 2 deletions

View File

@ -123,7 +123,9 @@ QIOSIntegration::QIOSIntegration()
}
m_touchDevice->setCapabilities(touchCapabilities);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
#if QT_CONFIG(tabletevent)
QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
#endif
QMacInternalPasteboardMime::initializeMimeTypes();
for (int i = 0; i < m_optionalPlugins->metaData().size(); ++i)

View File

@ -318,6 +318,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
QIOSIntegration *iosIntegration = QIOSIntegration::instance();
bool supportsPressure = QIOSIntegration::instance()->touchDevice()->capabilities() & QTouchDevice::Pressure;
#if QT_CONFIG(tabletevent)
if (m_activePencilTouch && [touches containsObject:m_activePencilTouch]) {
NSArray<UITouch *> *cTouches = [event coalescedTouchesForTouch:m_activePencilTouch];
int i = 0;
@ -347,6 +348,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
++i;
}
}
#endif
for (UITouch *uiTouch : m_activeTouches.keys()) {
QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch];
@ -393,16 +395,21 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
// points to QWindowSystemInterface::TouchPoints, and assigns each TouchPoint
// an id for use by Qt.
for (UITouch *touch in touches) {
#if QT_CONFIG(tabletevent)
if (touch.type == UITouchTypeStylus) {
if (Q_UNLIKELY(m_activePencilTouch)) {
qWarning("ignoring additional Pencil while first is still active");
continue;
}
m_activePencilTouch = touch;
} else {
} else
{
Q_ASSERT(!m_activeTouches.contains(touch));
#endif
m_activeTouches[touch].id = m_nextTouchId++;
#if QT_CONFIG(tabletevent)
}
#endif
}
if (m_qioswindow->shouldAutoActivateWindow() && m_activeTouches.size() == 1) {
@ -427,9 +434,12 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
// Remove ended touch points from the active set:
for (UITouch *touch in touches) {
#if QT_CONFIG(tabletevent)
if (touch.type == UITouchTypeStylus) {
m_activePencilTouch = nil;
} else {
} else
#endif
{
m_activeTouches.remove(touch);
}
}