diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-08-25 14:57:09 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-08-25 14:57:09 +0100 |
commit | b8372b52809378f860dfb0a9a9a97b30b5ad1a08 (patch) | |
tree | 271b70645f97f7fbb97c04c2d8337b781d042bcd /src/input | |
parent | 7a3db1facaac54053af5c8956ec04fcd8762a311 (diff) | |
parent | 150af04197682ccdbab509a95758fcdf957f63b2 (diff) |
Merge branch '5.7' into 5.8
Conflicts:
tests/auto/input/input.pro
Change-Id: Ic89c7d9093c95bc1c5ca50f04ed34c00b5f261f4
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/backend/abstractactioninput.cpp | 58 | ||||
-rw-r--r-- | src/input/backend/abstractactioninput_p.h | 81 | ||||
-rw-r--r-- | src/input/backend/actioninput.cpp | 32 | ||||
-rw-r--r-- | src/input/backend/actioninput_p.h | 6 | ||||
-rw-r--r-- | src/input/backend/backend.pri | 2 | ||||
-rw-r--r-- | src/input/backend/inputchord.cpp | 40 | ||||
-rw-r--r-- | src/input/backend/inputchord_p.h | 10 | ||||
-rw-r--r-- | src/input/backend/inputhandler.cpp | 10 | ||||
-rw-r--r-- | src/input/backend/inputhandler_p.h | 4 | ||||
-rw-r--r-- | src/input/backend/inputsequence.cpp | 41 | ||||
-rw-r--r-- | src/input/backend/inputsequence_p.h | 14 | ||||
-rw-r--r-- | src/input/backend/updateaxisactionjob.cpp | 62 | ||||
-rw-r--r-- | src/input/frontend/qinputaspect.cpp | 1 |
13 files changed, 274 insertions, 87 deletions
diff --git a/src/input/backend/abstractactioninput.cpp b/src/input/backend/abstractactioninput.cpp new file mode 100644 index 000000000..1d4366554 --- /dev/null +++ b/src/input/backend/abstractactioninput.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractactioninput_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +namespace Input { + +AbstractActionInput::AbstractActionInput() + : Qt3DCore::QBackendNode() +{ +} + +} // namespace Input + +} // namespace Qt3DInput + +QT_END_NAMESPACE + diff --git a/src/input/backend/abstractactioninput_p.h b/src/input/backend/abstractactioninput_p.h new file mode 100644 index 000000000..267d276c7 --- /dev/null +++ b/src/input/backend/abstractactioninput_p.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DINPUT_INPUT_ABSTRACTACTIONINPUT_H +#define QT3DINPUT_INPUT_ABSTRACTACTIONINPUT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <Qt3DCore/qbackendnode.h> +#include <Qt3DCore/qnodeid.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +namespace Input { + +class InputHandler; + +class Q_AUTOTEST_EXPORT AbstractActionInput : public Qt3DCore::QBackendNode +{ +public: + AbstractActionInput(); + + inline static qint64 milliToNano(qint64 milli) { return milli * 1000000; } + + virtual bool process(InputHandler *inputHandler, qint64 currentTime) = 0; +}; + +} // namespace Input + +} // namespace Qt3DInput + +QT_END_NAMESPACE + +#endif // QT3DINPUT_INPUT_ABSTRACTACTIONINPUT_H diff --git a/src/input/backend/actioninput.cpp b/src/input/backend/actioninput.cpp index b4cdd77ca..c22d20730 100644 --- a/src/input/backend/actioninput.cpp +++ b/src/input/backend/actioninput.cpp @@ -41,6 +41,8 @@ #include <Qt3DInput/qactioninput.h> #include <Qt3DInput/qabstractphysicaldevice.h> #include <Qt3DInput/private/qactioninput_p.h> +#include <Qt3DInput/private/qinputdeviceintegration_p.h> +#include <Qt3DInput/private/inputhandler_p.h> #include <Qt3DCore/qpropertyupdatedchange.h> QT_BEGIN_NAMESPACE @@ -50,7 +52,7 @@ namespace Qt3DInput { namespace Input { ActionInput::ActionInput() - : Qt3DCore::QBackendNode() + : AbstractActionInput() , m_buttons(0) { } @@ -65,7 +67,7 @@ void ActionInput::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr & void ActionInput::cleanup() { - QBackendNode::setEnabled(false); + setEnabled(false); m_sourceDevice = Qt3DCore::QNodeId(); m_buttons.clear(); } @@ -80,7 +82,31 @@ void ActionInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) m_buttons = propertyChange->value().value<QVector<int>>(); } } - QBackendNode::sceneChangeEvent(e); + AbstractActionInput::sceneChangeEvent(e); +} + +bool ActionInput::process(InputHandler *inputHandler, qint64 currentTime) +{ + Q_UNUSED(currentTime); + + QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = nullptr; + + const auto integrations = inputHandler->inputDeviceIntegrations(); + for (QInputDeviceIntegration *integration : integrations) { + physicalDeviceBackend = integration->physicalDevice(sourceDevice()); + if (physicalDeviceBackend) + break; + } + + if (!physicalDeviceBackend) + return false; + + for (int button : qAsConst(m_buttons)) { + if (physicalDeviceBackend->isButtonPressed(button)) + return true; + } + + return false; } } // namespace Input diff --git a/src/input/backend/actioninput_p.h b/src/input/backend/actioninput_p.h index c3e80ba63..da99c985e 100644 --- a/src/input/backend/actioninput_p.h +++ b/src/input/backend/actioninput_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <Qt3DCore/qbackendnode.h> +#include <Qt3DInput/private/abstractactioninput_p.h> #include <Qt3DCore/qnodeid.h> QT_BEGIN_NAMESPACE @@ -60,7 +60,7 @@ namespace Qt3DInput { namespace Input { -class Q_AUTOTEST_EXPORT ActionInput : public Qt3DCore::QBackendNode +class Q_AUTOTEST_EXPORT ActionInput : public AbstractActionInput { public: ActionInput(); @@ -70,6 +70,8 @@ public: inline Qt3DCore::QNodeId sourceDevice() const { return m_sourceDevice; } void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; + bool process(InputHandler *inputHandler, qint64 currentTime) Q_DECL_OVERRIDE; + private: void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL; diff --git a/src/input/backend/backend.pri b/src/input/backend/backend.pri index 74ee7f3b6..5c22f0e50 100644 --- a/src/input/backend/backend.pri +++ b/src/input/backend/backend.pri @@ -11,6 +11,7 @@ HEADERS += \ $$PWD/mousedevice_p.h \ $$PWD/mouseeventdispatcherjob_p.h \ $$PWD/mouseeventfilter_p.h \ + $$PWD/abstractactioninput_p.h \ $$PWD/abstractaxisinput_p.h \ $$PWD/actioninput_p.h \ $$PWD/axis_p.h \ @@ -43,6 +44,7 @@ SOURCES += \ $$PWD/mousedevice.cpp \ $$PWD/mouseeventfilter.cpp \ $$PWD/mouseeventdispatcherjob.cpp \ + $$PWD/abstractactioninput.cpp \ $$PWD/abstractaxisinput.cpp \ $$PWD/actioninput.cpp \ $$PWD/axis.cpp \ diff --git a/src/input/backend/inputchord.cpp b/src/input/backend/inputchord.cpp index 7ecd611a8..a37bb8ea4 100644 --- a/src/input/backend/inputchord.cpp +++ b/src/input/backend/inputchord.cpp @@ -40,6 +40,7 @@ #include "inputchord_p.h" #include <Qt3DInput/qinputchord.h> #include <Qt3DInput/private/qinputchord_p.h> +#include <Qt3DInput/private/inputhandler_p.h> #include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qpropertynodeaddedchange.h> #include <Qt3DCore/qpropertynoderemovedchange.h> @@ -51,7 +52,7 @@ namespace Qt3DInput { namespace Input { InputChord::InputChord() - : Qt3DCore::QBackendNode() + : AbstractActionInput() , m_chords() , m_inputsToTrigger() , m_timeout(0) @@ -64,12 +65,13 @@ void InputChord::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &c const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QInputChordData>>(change); const QInputChordData &data = typedChange->data; m_chords = data.chordIds; - m_timeout = data.timeout; + m_timeout = milliToNano(data.timeout); + m_inputsToTrigger = m_chords; } void InputChord::cleanup() { - QBackendNode::setEnabled(false); + setEnabled(false); m_timeout = 0; m_startTime = 0; m_chords.clear(); @@ -104,7 +106,7 @@ void InputChord::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) case Qt3DCore::PropertyUpdated: { const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e); if (change->propertyName() == QByteArrayLiteral("timeout")) - m_timeout = change->value().toInt(); + m_timeout = milliToNano(change->value().toInt()); break; } @@ -129,7 +131,35 @@ void InputChord::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) default: break; } - QBackendNode::sceneChangeEvent(e); + AbstractActionInput::sceneChangeEvent(e); +} + +bool InputChord::process(InputHandler *inputHandler, qint64 currentTime) +{ + const qint64 startTime = m_startTime; + bool triggered = false; + int activeInputs = 0; + for (const Qt3DCore::QNodeId &actionInputId : qAsConst(m_chords)) { + AbstractActionInput *actionInput = inputHandler->lookupActionInput(actionInputId); + if (actionInput && actionInput->process(inputHandler, currentTime)) { + triggered |= actionTriggered(actionInputId); + activeInputs++; + if (startTime == 0) + m_startTime = currentTime; + } + } + + if (startTime != 0) { + // Check if we are still inside the time limit for the chord + if ((currentTime - startTime) > m_timeout) { + reset(); + if (activeInputs > 0) + m_startTime = startTime; + return false; + } + } + + return triggered; } } // namespace Input diff --git a/src/input/backend/inputchord_p.h b/src/input/backend/inputchord_p.h index db197df3c..7f51f5d96 100644 --- a/src/input/backend/inputchord_p.h +++ b/src/input/backend/inputchord_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <Qt3DCore/qbackendnode.h> +#include <Qt3DInput/private/abstractactioninput_p.h> #include <Qt3DCore/qnodeid.h> QT_BEGIN_NAMESPACE @@ -60,26 +60,28 @@ namespace Qt3DInput { namespace Input { -class Q_AUTOTEST_EXPORT InputChord : public Qt3DCore::QBackendNode +class Q_AUTOTEST_EXPORT InputChord : public AbstractActionInput { public: InputChord(); void cleanup(); inline QVector<Qt3DCore::QNodeId> chords() const { return m_chords; } - inline int timeout() const { return m_timeout; } + inline qint64 timeout() const { return m_timeout; } inline qint64 startTime() const { return m_startTime; } void setStartTime(qint64 time); void reset(); bool actionTriggered(Qt3DCore::QNodeId input); void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; + bool process(InputHandler *inputHandler, qint64 currentTime) Q_DECL_OVERRIDE; + private: void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL; QVector<Qt3DCore::QNodeId> m_chords; QVector<Qt3DCore::QNodeId> m_inputsToTrigger; - int m_timeout; + qint64 m_timeout; qint64 m_startTime; }; diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp index a26ebce61..82b017b1c 100644 --- a/src/input/backend/inputhandler.cpp +++ b/src/input/backend/inputhandler.cpp @@ -309,6 +309,16 @@ void InputHandler::updateEventSource() } } +AbstractActionInput *InputHandler::lookupActionInput(Qt3DCore::QNodeId id) const +{ + AbstractActionInput *input = nullptr; + if ((input = actionInputManager()->lookupResource(id)) != nullptr) + return input; + if ((input = inputSequenceManager()->lookupResource(id)) != nullptr) + return input; + return inputChordManager()->lookupResource(id); // nullptr if not found +} + } // namespace Input } // namespace Qt3DInput diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h index 72078b54c..2cfb56e3f 100644 --- a/src/input/backend/inputhandler_p.h +++ b/src/input/backend/inputhandler_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { class QEventFilterService; +class QNodeId; } namespace Qt3DInput { @@ -69,6 +70,7 @@ class QInputDeviceIntegration; namespace Input { +class AbstractActionInput; class KeyboardInputManager; class KeyboardDeviceManager; class KeyboardEventFilter; @@ -144,6 +146,8 @@ public: void updateEventSource(); + AbstractActionInput *lookupActionInput(Qt3DCore::QNodeId id) const; + private: KeyboardDeviceManager *m_keyboardDeviceManager; KeyboardInputManager *m_keyboardInputManager; diff --git a/src/input/backend/inputsequence.cpp b/src/input/backend/inputsequence.cpp index aae88f9a1..378a7d33d 100644 --- a/src/input/backend/inputsequence.cpp +++ b/src/input/backend/inputsequence.cpp @@ -41,6 +41,7 @@ #include <Qt3DInput/qinputsequence.h> #include <Qt3DInput/qabstractphysicaldevice.h> #include <Qt3DInput/private/qinputsequence_p.h> +#include <Qt3DInput/private/inputhandler_p.h> #include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/qpropertynodeaddedchange.h> #include <Qt3DCore/qpropertynoderemovedchange.h> @@ -53,7 +54,7 @@ namespace Qt3DInput { namespace Input { InputSequence::InputSequence() - : Qt3DCore::QBackendNode() + : AbstractActionInput() , m_sequences() , m_inputsToTrigger() , m_timeout(0) @@ -68,13 +69,14 @@ void InputSequence::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QInputSequenceData>>(change); const QInputSequenceData &data = typedChange->data; m_sequences = data.sequenceIds; - m_timeout = data.timeout; - m_buttonInterval = data.buttonInterval; + m_timeout = milliToNano(data.timeout); + m_buttonInterval = milliToNano(data.buttonInterval); + m_inputsToTrigger = m_sequences; } void InputSequence::cleanup() { - QBackendNode::setEnabled(false); + setEnabled(false); m_timeout = 0; m_buttonInterval = 0; m_startTime = 0; @@ -99,6 +101,9 @@ void InputSequence::reset() bool InputSequence::actionTriggered(Qt3DCore::QNodeId input, const qint64 currentTime) { + if (input != m_inputsToTrigger.first()) + return false; + // Save the last input m_lastInputId = input; // Return false if we've spent too much time in between two sequences @@ -126,9 +131,9 @@ void InputSequence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) case Qt3DCore::PropertyUpdated: { const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e); if (change->propertyName() == QByteArrayLiteral("timeout")) { - m_timeout = change->value().toInt(); + m_timeout = milliToNano(change->value().toInt()); } else if (change->propertyName() == QByteArrayLiteral("buttonInterval")) { - m_buttonInterval = change->value().toInt(); + m_buttonInterval = milliToNano(change->value().toInt()); } break; } @@ -154,7 +159,29 @@ void InputSequence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) default: break; } - QBackendNode::sceneChangeEvent(e); + AbstractActionInput::sceneChangeEvent(e); +} + +bool InputSequence::process(InputHandler *inputHandler, qint64 currentTime) +{ + if (m_startTime != 0) { + // Check if we are still inside the time limit for the sequence + if ((currentTime - m_startTime) > m_timeout) { + reset(); + return false; + } + } + + bool triggered = false; + for (const Qt3DCore::QNodeId &actionInputId : qAsConst(m_sequences)) { + AbstractActionInput *actionInput = inputHandler->lookupActionInput(actionInputId); + if (actionInput && actionInput->process(inputHandler, currentTime)) { + triggered |= actionTriggered(actionInputId, currentTime); + if (m_startTime == 0) + m_startTime = currentTime; + } + } + return triggered; } } // namespace Input diff --git a/src/input/backend/inputsequence_p.h b/src/input/backend/inputsequence_p.h index a76457f4e..28cb1c0e1 100644 --- a/src/input/backend/inputsequence_p.h +++ b/src/input/backend/inputsequence_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <Qt3DCore/qbackendnode.h> +#include <Qt3DInput/private/abstractactioninput_p.h> #include <Qt3DCore/qnodeid.h> QT_BEGIN_NAMESPACE @@ -60,15 +60,15 @@ namespace Qt3DInput { namespace Input { -class Q_AUTOTEST_EXPORT InputSequence : public Qt3DCore::QBackendNode +class Q_AUTOTEST_EXPORT InputSequence : public AbstractActionInput { public: InputSequence(); void cleanup(); inline QVector<Qt3DCore::QNodeId> sequences() const { return m_sequences; } - inline int timeout() const { return m_timeout; } - inline int buttonInterval() const { return m_buttonInterval; } + inline qint64 timeout() const { return m_timeout; } + inline qint64 buttonInterval() const { return m_buttonInterval; } inline qint64 startTime() const { return m_startTime; } void setStartTime(qint64 time); bool sequenceTriggered() const; @@ -76,13 +76,15 @@ public: bool actionTriggered(Qt3DCore::QNodeId input, const qint64 currentTime); void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; + bool process(InputHandler *inputHandler, qint64 currentTime) Q_DECL_OVERRIDE; + private: void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL; QVector<Qt3DCore::QNodeId> m_sequences; QVector<Qt3DCore::QNodeId> m_inputsToTrigger; - int m_timeout; - int m_buttonInterval; + qint64 m_timeout; + qint64 m_buttonInterval; qint64 m_startTime; qint64 m_lastInputTime; Qt3DCore::QNodeId m_lastInputId; diff --git a/src/input/backend/updateaxisactionjob.cpp b/src/input/backend/updateaxisactionjob.cpp index 3a1bfb465..0cbd325c9 100644 --- a/src/input/backend/updateaxisactionjob.cpp +++ b/src/input/backend/updateaxisactionjob.cpp @@ -101,65 +101,9 @@ void UpdateAxisActionJob::updateAction(LogicalDevice *device) bool UpdateAxisActionJob::processActionInput(const Qt3DCore::QNodeId actionInputId) { - - if (m_handler->actionInputManager()->lookupResource(actionInputId)) { - ActionInput *actionInput = m_handler->actionInputManager()->lookupResource(actionInputId); - QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = nullptr; - - const auto integrations = m_handler->inputDeviceIntegrations(); - for (QInputDeviceIntegration *integration : integrations) { - if ((physicalDeviceBackend = integration->physicalDevice(actionInput->sourceDevice())) != nullptr) - break; - } - - if (physicalDeviceBackend != nullptr) { - // Update the value - return anyOfRequiredButtonsPressed(actionInput->buttons(), physicalDeviceBackend); - } - } else if (m_handler->inputSequenceManager()->lookupResource(actionInputId)) { - InputSequence *inputSequence = m_handler->inputSequenceManager()->lookupResource(actionInputId); - const qint64 startTime = inputSequence->startTime(); - if (startTime != 0) { - // Check if we are still inside the time limit for the chord - if ((m_currentTime - startTime) > inputSequence->timeout()) { - inputSequence->reset(); - return false; - } - } - bool actionTriggered = false; - const auto actionInputIds = inputSequence->sequences(); - for (const Qt3DCore::QNodeId actionInputId : actionInputIds) { - if (processActionInput(actionInputId)){ - actionTriggered |= inputSequence->actionTriggered(actionInputId, m_currentTime); - // Set the start time if it wasn't set before - if (startTime == 0) - inputSequence->setStartTime(m_currentTime); - } - } - return actionTriggered; - } else if (m_handler->inputChordManager()->lookupResource(actionInputId)) { - InputChord *inputChord = m_handler->inputChordManager()->lookupResource(actionInputId); - const qint64 startTime = inputChord->startTime(); - if (startTime != 0) { - // Check if we are still inside the time limit for the chord - if ((m_currentTime - startTime) > inputChord->timeout()) { - inputChord->reset(); - return false; - } - } - bool actionTriggered = false; - const auto actionInputIds = inputChord->chords(); - for (const Qt3DCore::QNodeId actionInputId : actionInputIds) { - if (processActionInput(actionInputId)){ - actionTriggered |= inputChord->actionTriggered(actionInputId); - if (startTime == 0) - inputChord->setStartTime(m_currentTime); - } - } - return actionTriggered; - } - //Should Never reach this point - return false; + AbstractActionInput *actionInput = m_handler->lookupActionInput(actionInputId); + Q_ASSERT(actionInput); + return actionInput->process(m_handler, m_currentTime); } void UpdateAxisActionJob::updateAxis(LogicalDevice *device) diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp index d544bed70..342998556 100644 --- a/src/input/frontend/qinputaspect.cpp +++ b/src/input/frontend/qinputaspect.cpp @@ -214,7 +214,6 @@ QStringList QInputAspect::availablePhysicalDevices() const */ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) { - Q_UNUSED(time); Q_D(QInputAspect); QVector<QAspectJobPtr> jobs; |