summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-04 14:03:03 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-04 14:03:03 +0200
commit67dea992954a4499d81ee63457263f913ca92c50 (patch)
tree352e5879cd0bd50f3fe27117530ea1f601b97079 /src/input
parentba2974a8abdf0048d2c8ecc821d369c74598e39f (diff)
parentd947ef04bc162d9f1816afb6188e8ef0a30c5143 (diff)
Merge 5.9 into 5.9.0
Diffstat (limited to 'src/input')
-rw-r--r--src/input/backend/inputhandler.cpp20
-rw-r--r--src/input/backend/inputhandler_p.h4
-rw-r--r--src/input/backend/mousedevice.cpp2
-rw-r--r--src/input/backend/mousedevice_p.h2
-rw-r--r--src/input/backend/mouseeventdispatcherjob.cpp11
-rw-r--r--src/input/backend/mouseeventdispatcherjob_p.h9
-rw-r--r--src/input/backend/mouseeventfilter.cpp2
-rw-r--r--src/input/backend/mousehandler.cpp2
-rw-r--r--src/input/backend/mousehandler_p.h2
-rw-r--r--src/input/frontend/qinputdeviceintegrationfactory.cpp5
-rw-r--r--src/input/frontend/qkeyevent.h2
-rw-r--r--src/input/frontend/qmouseevent.cpp2
-rw-r--r--src/input/frontend/qmouseevent.h13
-rw-r--r--src/input/frontend/qmousehandler.cpp4
-rw-r--r--src/input/frontend/qmousehandler.h2
15 files changed, 73 insertions, 9 deletions
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index 985d67470..525a45b6c 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -163,6 +163,7 @@ void InputHandler::clearPendingMouseEvents()
m_pendingMouseEvents.clear();
}
+#if QT_CONFIG(wheelevent)
void InputHandler::appendWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &event)
{
QMutexLocker lock(&m_mutex);
@@ -180,7 +181,7 @@ void InputHandler::clearPendingWheelEvents()
QMutexLocker lock(&m_mutex);
m_pendingWheelEvents.clear();
}
-
+#endif
void InputHandler::appendKeyboardDevice(HKeyboardDevice device)
{
@@ -249,15 +250,23 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs()
{
QVector<QAspectJobPtr> jobs;
const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> mouseEvents = pendingMouseEvents();
+#if QT_CONFIG(wheelevent)
const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> wheelEvents = pendingWheelEvents();
+#endif
for (const HMouseDevice cHandle : qAsConst(m_activeMouseDevices)) {
MouseDevice *controller = m_mouseDeviceManager->data(cHandle);
controller->updateMouseEvents(mouseEvents);
+#if QT_CONFIG(wheelevent)
controller->updateWheelEvents(wheelEvents);
+#endif
// Event dispacthing job
- if (!mouseEvents.isEmpty() || !wheelEvents.empty()) {
+ if (!mouseEvents.isEmpty()
+#if QT_CONFIG(wheelevent)
+ || !wheelEvents.empty()
+#endif
+ ) {
// Send the events to the mouse handlers that have for sourceDevice controller
const QVector<HMouseHandler> activeMouseHandlers = m_mouseInputManager->activeHandles();
for (HMouseHandler mouseHandlerHandle : activeMouseHandlers) {
@@ -267,8 +276,11 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs()
if (mouseHandler->mouseDevice() == controller->peerId()) {
MouseEventDispatcherJob *job = new MouseEventDispatcherJob(mouseHandler->peerId(),
- mouseEvents,
- wheelEvents);
+ mouseEvents
+#if QT_CONFIG(wheelevent)
+ , wheelEvents
+#endif
+ );
job->setInputHandler(this);
jobs.append(QAspectJobPtr(job));
}
diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h
index e80441f1a..a2a38262d 100644
--- a/src/input/backend/inputhandler_p.h
+++ b/src/input/backend/inputhandler_p.h
@@ -127,9 +127,11 @@ public:
QList<QT_PREPEND_NAMESPACE(QMouseEvent)> pendingMouseEvents();
void clearPendingMouseEvents();
+#if QT_CONFIG(wheelevent)
void appendWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &event);
QList<QT_PREPEND_NAMESPACE(QWheelEvent)> pendingWheelEvents();
void clearPendingWheelEvents();
+#endif
void appendKeyboardDevice(HKeyboardDevice device);
void removeKeyboardDevice(HKeyboardDevice device);
@@ -170,7 +172,9 @@ private:
QList<QT_PREPEND_NAMESPACE(QKeyEvent)> m_pendingKeyEvents;
QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_pendingMouseEvents;
+#if QT_CONFIG(wheelevent)
QList<QT_PREPEND_NAMESPACE(QWheelEvent)> m_pendingWheelEvents;
+#endif
mutable QMutex m_mutex;
AxisManager *m_axisManager;
diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp
index 1d329252d..128988637 100644
--- a/src/input/backend/mousedevice.cpp
+++ b/src/input/backend/mousedevice.cpp
@@ -135,6 +135,7 @@ float MouseDevice::sensitivity() const
return m_sensitivity;
}
+#if QT_CONFIG(wheelevent)
void MouseDevice::updateWheelEvents(const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &events)
{
// Reset axis values before we accumulate new values for this frame
@@ -147,6 +148,7 @@ void MouseDevice::updateWheelEvents(const QList<QT_PREPEND_NAMESPACE (QWheelEven
}
}
}
+#endif
void MouseDevice::updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events)
{
diff --git a/src/input/backend/mousedevice_p.h b/src/input/backend/mousedevice_p.h
index 0b95c6183..a085194ff 100644
--- a/src/input/backend/mousedevice_p.h
+++ b/src/input/backend/mousedevice_p.h
@@ -99,7 +99,9 @@ public:
bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
void updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events);
+#if QT_CONFIG(wheelevent)
void updateWheelEvents(const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &events);
+#endif
MouseState mouseState() const;
QPointF previousPos() const;
diff --git a/src/input/backend/mouseeventdispatcherjob.cpp b/src/input/backend/mouseeventdispatcherjob.cpp
index 77eb69712..11653d8a8 100644
--- a/src/input/backend/mouseeventdispatcherjob.cpp
+++ b/src/input/backend/mouseeventdispatcherjob.cpp
@@ -50,13 +50,18 @@ namespace Qt3DInput {
namespace Input {
MouseEventDispatcherJob::MouseEventDispatcherJob(Qt3DCore::QNodeId input,
- const QList<QT_PREPEND_NAMESPACE (QMouseEvent)> &mouseEvents,
- const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &wheelEvents)
+ const QList<QT_PREPEND_NAMESPACE (QMouseEvent)> &mouseEvents
+#if QT_CONFIG(wheelevent)
+ , const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &wheelEvents
+#endif
+ )
: QAspectJob()
, m_inputHandler(nullptr)
, m_mouseInput(input)
, m_mouseEvents(mouseEvents)
+#if QT_CONFIG(wheelevent)
, m_wheelEvents(wheelEvents)
+#endif
{
SET_JOB_RUN_STAT_TYPE(this, JobTypes::MouseEventDispatcher, 0);
}
@@ -73,8 +78,10 @@ void MouseEventDispatcherJob::run()
// Send mouse and wheel events to frontend
for (const QT_PREPEND_NAMESPACE(QMouseEvent) &e : m_mouseEvents)
input->mouseEvent(QMouseEventPtr(new QMouseEvent(e)));
+#if QT_CONFIG(wheelevent)
for (const QT_PREPEND_NAMESPACE(QWheelEvent) &e : m_wheelEvents)
input->wheelEvent(QWheelEventPtr(new QWheelEvent(e)));
+#endif
}
}
diff --git a/src/input/backend/mouseeventdispatcherjob_p.h b/src/input/backend/mouseeventdispatcherjob_p.h
index ebf1538e4..366774005 100644
--- a/src/input/backend/mouseeventdispatcherjob_p.h
+++ b/src/input/backend/mouseeventdispatcherjob_p.h
@@ -66,8 +66,11 @@ class MouseEventDispatcherJob : public Qt3DCore::QAspectJob
{
public:
explicit MouseEventDispatcherJob(Qt3DCore::QNodeId input,
- const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &mouseEvents,
- const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &wheelEvents);
+ const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &mouseEvents
+#if QT_CONFIG(wheelevent)
+ , const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &wheelEvents
+#endif
+ );
void setInputHandler(InputHandler *handler);
void run() Q_DECL_FINAL;
@@ -75,7 +78,9 @@ private:
InputHandler *m_inputHandler;
const Qt3DCore::QNodeId m_mouseInput;
const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_mouseEvents;
+#if QT_CONFIG(wheelevent)
const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> m_wheelEvents;
+#endif
};
} // namespace Input
diff --git a/src/input/backend/mouseeventfilter.cpp b/src/input/backend/mouseeventfilter.cpp
index bc2473a33..618a64b15 100644
--- a/src/input/backend/mouseeventfilter.cpp
+++ b/src/input/backend/mouseeventfilter.cpp
@@ -80,10 +80,12 @@ bool MouseEventFilter::eventFilter(QObject *obj, QEvent *e)
// Creates copy and store event to be processed later on in an InputAspect job
m_inputHandler->appendMouseEvent(QMouseEvent(*static_cast<QMouseEvent *>(e)));
break;
+#if QT_CONFIG(wheelevent)
case QEvent::Wheel:
// Creates copy and store event to be processed later on in an InputAspect job
m_inputHandler->appendWheelEvent(QWheelEvent(*static_cast<QWheelEvent *>(e)));
break;
+#endif
default:
break;
}
diff --git a/src/input/backend/mousehandler.cpp b/src/input/backend/mousehandler.cpp
index a0619aaf2..c492dcf28 100644
--- a/src/input/backend/mousehandler.cpp
+++ b/src/input/backend/mousehandler.cpp
@@ -91,6 +91,7 @@ void MouseHandler::mouseEvent(const QMouseEventPtr &event)
notifyObservers(e);
}
+#if QT_CONFIG(wheelevent)
void MouseHandler::wheelEvent(const QWheelEventPtr &event)
{
auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
@@ -99,6 +100,7 @@ void MouseHandler::wheelEvent(const QWheelEventPtr &event)
e->setValue(QVariant::fromValue(event));
notifyObservers(e);
}
+#endif
void MouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
diff --git a/src/input/backend/mousehandler_p.h b/src/input/backend/mousehandler_p.h
index 867764017..ae484d8d6 100644
--- a/src/input/backend/mousehandler_p.h
+++ b/src/input/backend/mousehandler_p.h
@@ -70,7 +70,9 @@ public:
Qt3DCore::QNodeId mouseDevice() const;
void setInputHandler(InputHandler *handler);
void mouseEvent(const QMouseEventPtr &event);
+#if QT_CONFIG(wheelevent)
void wheelEvent(const QWheelEventPtr &event);
+#endif
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
diff --git a/src/input/frontend/qinputdeviceintegrationfactory.cpp b/src/input/frontend/qinputdeviceintegrationfactory.cpp
index 052f2d2b2..957b33542 100644
--- a/src/input/frontend/qinputdeviceintegrationfactory.cpp
+++ b/src/input/frontend/qinputdeviceintegrationfactory.cpp
@@ -74,6 +74,7 @@ QStringList QInputDeviceIntegrationFactory::keys(const QString &pluginPath)
list.append(loader()->keyMap().values());
return list;
#else
+ Q_UNUSED(pluginPath);
return QStringList();
#endif
}
@@ -88,6 +89,10 @@ QInputDeviceIntegration *QInputDeviceIntegrationFactory::create(const QString &n
}
if (QInputDeviceIntegration *ret = qLoadPlugin<QInputDeviceIntegration, QInputDevicePlugin>(loader(), name, args))
return ret;
+#else
+ Q_UNUSED(name);
+ Q_UNUSED(args);
+ Q_UNUSED(pluginPath);
#endif
return nullptr;
}
diff --git a/src/input/frontend/qkeyevent.h b/src/input/frontend/qkeyevent.h
index 23fed5545..e028438ce 100644
--- a/src/input/frontend/qkeyevent.h
+++ b/src/input/frontend/qkeyevent.h
@@ -78,7 +78,9 @@ public:
inline bool isAccepted() const { return m_event.isAccepted(); }
inline void setAccepted(bool accepted) { m_event.setAccepted(accepted); }
inline QEvent::Type type() const { return m_event.type(); }
+#if QT_CONFIG(shortcut)
Q_INVOKABLE bool matches(QKeySequence::StandardKey key_) const { return m_event.matches(key_); }
+#endif
private:
QT_PREPEND_NAMESPACE(QKeyEvent) m_event;
diff --git a/src/input/frontend/qmouseevent.cpp b/src/input/frontend/qmouseevent.cpp
index b1574f623..62f7a097e 100644
--- a/src/input/frontend/qmouseevent.cpp
+++ b/src/input/frontend/qmouseevent.cpp
@@ -455,6 +455,7 @@ QMouseEvent::Modifiers QMouseEvent::modifiers() const
* Returns the QEvent::Type of the event.
*/
+#if QT_CONFIG(wheelevent)
/*!
* Constructs a new QWheelEvent instance from the QWheelEvent \a e.
*/
@@ -497,6 +498,7 @@ QWheelEvent::Modifiers QWheelEvent::modifiers() const
return QWheelEvent::NoModifier;
}
}
+#endif // QT_CONFIG(wheelevent)
} // namespace Qt3DInput
diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h
index 043f1023d..63786ac28 100644
--- a/src/input/frontend/qmouseevent.h
+++ b/src/input/frontend/qmouseevent.h
@@ -85,7 +85,13 @@ public:
inline int x() const { return m_event.x(); }
inline int y() const { return m_event.y(); }
- inline bool wasHeld() const { return static_cast<Qt::GestureType>(m_event.type()) == Qt::TapAndHoldGesture; }
+ inline bool wasHeld() const {
+#if QT_CONFIG(gestures)
+ return static_cast<Qt::GestureType>(m_event.type()) == Qt::TapAndHoldGesture;
+#else
+ return false;
+#endif
+ }
Buttons button() const;
int buttons() const;
Modifiers modifiers() const;
@@ -100,6 +106,7 @@ private:
typedef QSharedPointer<QMouseEvent> QMouseEventPtr;
+#if QT_CONFIG(wheelevent)
class QT3DINPUTSHARED_EXPORT QWheelEvent : public QObject
{
Q_OBJECT
@@ -148,12 +155,16 @@ private:
};
typedef QSharedPointer<QWheelEvent> QWheelEventPtr;
+#endif
} // namespace Qt3DInput
QT_END_NAMESPACE
Q_DECLARE_METATYPE(Qt3DInput::QMouseEvent*) // LCOV_EXCL_LINE
+
+#if QT_CONFIG(wheelevent)
Q_DECLARE_METATYPE(Qt3DInput::QWheelEvent*) // LCOV_EXCL_LINE
+#endif
#endif // QT3DINPUT_QMOUSEEVENT_H
diff --git a/src/input/frontend/qmousehandler.cpp b/src/input/frontend/qmousehandler.cpp
index 750251be9..419052d8a 100644
--- a/src/input/frontend/qmousehandler.cpp
+++ b/src/input/frontend/qmousehandler.cpp
@@ -83,9 +83,11 @@ void QMouseHandlerPrivate::mouseEvent(const QMouseEventPtr &event)
m_pressAndHoldTimer->stop();
emit q->released(event.data());
break;
+#if QT_CONFIG(gestures)
case Qt::TapGesture:
emit q->clicked(event.data());
break;
+#endif
case QEvent::MouseButtonDblClick:
emit q->doubleClicked(event.data());
break;
@@ -311,9 +313,11 @@ void QMouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
if (e->propertyName() == QByteArrayLiteral("mouse")) {
QMouseEventPtr ev = e->value().value<QMouseEventPtr>();
d->mouseEvent(ev);
+#if QT_CONFIG(wheelevent)
} else if (e->propertyName() == QByteArrayLiteral("wheel")) {
QWheelEventPtr ev = e->value().value<QWheelEventPtr>();
emit wheel(ev.data());
+#endif
}
}
}
diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h
index 750ed394d..ef4267c5c 100644
--- a/src/input/frontend/qmousehandler.h
+++ b/src/input/frontend/qmousehandler.h
@@ -82,7 +82,9 @@ Q_SIGNALS:
void pressAndHold(Qt3DInput::QMouseEvent *mouse);
void positionChanged(Qt3DInput::QMouseEvent *mouse);
+#if QT_CONFIG(wheelevent)
void wheel(Qt3DInput::QWheelEvent *wheel);
+#endif
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;