summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2016-08-24 08:29:59 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-08-24 19:33:29 +0000
commitc899e0f334f02c1483665cf4cca10cbfaf3b7d18 (patch)
tree4c18bd304de7ec934c2be433c8316d7a7f1a6069 /src/input
parent54765577f1b89175f8b1fae842c9ffd2c96f4943 (diff)
Fix timeout handling in input chords
Change-Id: Ic4ab2d781403ada1206e7429ad1cd16ea2330aed Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/input')
-rw-r--r--src/input/backend/inputchord.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/input/backend/inputchord.cpp b/src/input/backend/inputchord.cpp
index cbac127b4..260048f99 100644
--- a/src/input/backend/inputchord.cpp
+++ b/src/input/backend/inputchord.cpp
@@ -136,23 +136,29 @@ void InputChord::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
bool InputChord::process(InputHandler *inputHandler, qint64 currentTime)
{
- if (m_startTime != 0) {
- // Check if we are still inside the time limit for the chord
- if ((currentTime - m_startTime) > m_timeout) {
- reset();
- return false;
- }
- }
-
+ 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);
- if (m_startTime == 0)
+ 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;
}