Merge lp:~chasedouglas/grail/atomic-timeout-fix into lp:grail

Proposed by Chase Douglas
Status: Merged
Merged at revision: 200
Proposed branch: lp:~chasedouglas/grail/atomic-timeout-fix
Merge into: lp:grail
Prerequisite: lp:~chasedouglas/grail/atomic-timeout-test
Diff against target: 72 lines (+26/-2)
3 files modified
src/v3/atomic-recognizer.cpp (+22/-0)
src/v3/atomic-recognizer.h (+2/-0)
src/v3/recognizer.h (+2/-2)
To merge this branch: bzr merge lp:~chasedouglas/grail/atomic-timeout-fix
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
Review via email: mp+98025@code.launchpad.net

Description of the change

Fix atomic timeout calculation.

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Looks ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/v3/atomic-recognizer.cpp'
2--- src/v3/atomic-recognizer.cpp 2012-03-14 20:12:00 +0000
3+++ src/v3/atomic-recognizer.cpp 2012-03-16 23:31:19 +0000
4@@ -70,6 +70,11 @@
5 FindGestureToAccept(event_time);
6 }
7
8+void AtomicRecognizer::UpdateTime(uint64_t time) {
9+ Recognizer::UpdateTime(time);
10+ FindGestureToAccept(time);
11+}
12+
13 /**
14 * @internal
15 * Perform tasks necessary for when new touches occur and there is an existing
16@@ -304,5 +309,22 @@
17 }
18 }
19
20+uint64_t AtomicRecognizer::NextTimeout() {
21+ uint64_t timeout = Recognizer::NextTimeout();
22+
23+ /* Check for any active gestures that are kept back due to waiting for the
24+ * composition time to pass before flushing the queue */
25+ for (const SharedGesture& gesture : unaccepted_gestures_) {
26+ if (!gesture->IsActive())
27+ continue;
28+
29+ uint64_t new_timeout = gesture->start_time() + kCompositionTime;
30+ if (new_timeout < timeout)
31+ timeout = new_timeout;
32+ }
33+
34+ return timeout;
35+}
36+
37 } // namespace grail
38 } // namespace utouch
39
40=== modified file 'src/v3/atomic-recognizer.h'
41--- src/v3/atomic-recognizer.h 2012-03-14 20:12:00 +0000
42+++ src/v3/atomic-recognizer.h 2012-03-16 23:31:19 +0000
43@@ -33,6 +33,7 @@
44
45 virtual bool atomic() const {return true;}
46 virtual void ProcessFrameEvent(const UFEvent event);
47+ virtual void UpdateTime(uint64_t time);
48
49 private:
50 void HandleNewTouchesForAcceptedGesture(const SharedGesture& gesture);
51@@ -41,6 +42,7 @@
52 void MatchSubscriptionsForNewTouches();
53 void MatchGestures();
54 void FindGestureToAccept(uint64_t event_time);
55+ virtual uint64_t NextTimeout();
56
57 /* Touches that have begun but not yet been matched against subscriptions
58 (for the creation of new gestures) or used to update existing gestures. */
59
60=== modified file 'src/v3/recognizer.h'
61--- src/v3/recognizer.h 2012-03-14 20:12:00 +0000
62+++ src/v3/recognizer.h 2012-03-16 23:31:19 +0000
63@@ -71,8 +71,8 @@
64
65 UGStatus ActivateSubscription(UGSubscription* subscription);
66 void DeactivateSubscription(UGSubscription* subscription);
67- void UpdateTime(uint64_t time);
68- uint64_t NextTimeout();
69+ virtual void UpdateTime(uint64_t time);
70+ virtual uint64_t NextTimeout();
71 UGStatus AcceptGesture(unsigned int id);
72 UGStatus RejectGesture(unsigned int id);
73

Subscribers

People subscribed via source and target branches