Merge lp:~bregma/grail/lp-1475888 into lp:grail

Proposed by Stephen M. Webb
Status: Merged
Approved by: Brandon Schaefer
Approved revision: 260
Merged at revision: 258
Proposed branch: lp:~bregma/grail/lp-1475888
Merge into: lp:grail
Diff against target: 146 lines (+16/-27)
5 files modified
m4/xorg-gtest.m4 (+7/-6)
src/subscription.cpp (+4/-16)
src/subscription.h (+2/-2)
test/gtest/Makefile.am (+2/-2)
test/integration/x11/timeout.cpp (+1/-1)
To merge this branch: bzr merge lp:~bregma/grail/lp-1475888
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+283856@code.launchpad.net

Commit message

timeout: stored uint64_t instead of converting back and forth to float

Description of the change

Used a uint64_t for transient storage of timeouts instead of floats to eliminate all the back-and-forth conversions.

Fixes lp:1475888 and deb:753646

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'm4/xorg-gtest.m4'
2--- m4/xorg-gtest.m4 2012-12-06 15:49:37 +0000
3+++ m4/xorg-gtest.m4 2016-01-25 18:38:26 +0000
4@@ -1,4 +1,4 @@
5-# serial 3
6+# serial 9
7
8 # Copyright (C) 2012 Canonical, Ltd.
9 #
10@@ -32,16 +32,17 @@
11 # Both default actions are no-ops.
12 AC_DEFUN([CHECK_XORG_GTEST],
13 [
14- AC_REQUIRE([CHECK_GTEST])
15-
16 PKG_CHECK_EXISTS([xorg-gtest],
17 [have_xorg_gtest=yes],
18 [have_xorg_gtest=no])
19
20 XORG_GTEST_SOURCE=`$PKG_CONFIG --variable=sourcedir --print-errors xorg-gtest`
21+ GTEST_SOURCE="$XORG_GTEST_SOURCE/src/gtest"
22+ GTEST_CPPFLAGS="-I$XORG_GTEST_SOURCE/src/gtest/include -I$XORG_GTEST_SOURCE/src/gtest"
23 XORG_GTEST_CPPFLAGS=`$PKG_CONFIG --variable=CPPflags --print-errors xorg-gtest`
24 XORG_GTEST_CPPFLAGS="$GTEST_CPPFLAGS $XORG_GTEST_CPPFLAGS"
25 XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -I$XORG_GTEST_SOURCE"
26+ XORG_GTEST_LDFLAGS="-lpthread -lX11 -lXi"
27
28 PKG_CHECK_MODULES(X11, [x11], [have_x11=yes], [have_x11=no])
29
30@@ -63,12 +64,12 @@
31 AS_IF([test "x$have_xorg_gtest_evemu" = xyes],
32 [XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -DHAVE_EVEMU"])
33
34- AS_IF([test "x$have_gtest" != xyes -o "x$have_x11" != xyes],
35- [have_xorg_gtest=no])
36-
37 AS_IF([test "x$have_xorg_gtest" = xyes],
38+ [AC_SUBST(GTEST_SOURCE)]
39+ [AC_SUBST(GTEST_CPPFLAGS)]
40 [AC_SUBST(XORG_GTEST_SOURCE)]
41 [AC_SUBST(XORG_GTEST_CPPFLAGS)]
42+ [AC_SUBST(XORG_GTEST_LDFLAGS)]
43
44 # Get BASE_CXXFLAGS and STRICT_CXXFLAGS
45 [XORG_MACROS_VERSION(1.17)]
46
47=== modified file 'src/subscription.cpp'
48--- src/subscription.cpp 2012-06-21 20:30:14 +0000
49+++ src/subscription.cpp 2016-01-25 18:38:26 +0000
50@@ -104,10 +104,7 @@
51 }
52
53 case UGSubscriptionPropertyDragTimeout: {
54- uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);
55- if (timeout < 0)
56- return UGStatusErrorInvalidValue;
57- drag_.timeout = timeout;
58+ drag_.timeout = *reinterpret_cast<const uint64_t*>(value);
59 return UGStatusSuccess;
60 }
61
62@@ -120,10 +117,7 @@
63 }
64
65 case UGSubscriptionPropertyPinchTimeout: {
66- uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);
67- if (timeout < 0)
68- return UGStatusErrorInvalidValue;
69- pinch_.timeout = timeout;
70+ pinch_.timeout = *reinterpret_cast<const uint64_t*>(value);
71 return UGStatusSuccess;
72 }
73
74@@ -136,10 +130,7 @@
75 }
76
77 case UGSubscriptionPropertyRotateTimeout: {
78- uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);
79- if (timeout < 0)
80- return UGStatusErrorInvalidValue;
81- rotate_.timeout = timeout;
82+ rotate_.timeout = *reinterpret_cast<const uint64_t*>(value);
83 return UGStatusSuccess;
84 }
85
86@@ -152,10 +143,7 @@
87 }
88
89 case UGSubscriptionPropertyTapTimeout: {
90- uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);
91- if (timeout < 0)
92- return UGStatusErrorInvalidValue;
93- tap_.timeout = timeout;
94+ tap_.timeout = *reinterpret_cast<const uint64_t*>(value);
95 return UGStatusSuccess;
96 }
97
98
99=== modified file 'src/subscription.h'
100--- src/subscription.h 2012-11-21 13:20:10 +0000
101+++ src/subscription.h 2016-01-25 18:38:26 +0000
102@@ -2,7 +2,7 @@
103 *
104 * grail - Multitouch Gesture Recognition Library
105 *
106- * Copyright (C) 2011-2012 Canonical Ltd.
107+ * Copyright (C) 2011-2012,2016 Canonical Ltd.
108 *
109 * This library is free software: you can redistribute it and/or modify it
110 * under the terms of the GNU Lesser General Public License version 3
111@@ -33,7 +33,7 @@
112 public:
113
114 struct Limit {
115- float timeout;
116+ uint64_t timeout;
117 float threshold;
118 };
119
120
121=== modified file 'test/gtest/Makefile.am'
122--- test/gtest/Makefile.am 2012-07-03 22:20:38 +0000
123+++ test/gtest/Makefile.am 2016-01-25 18:38:26 +0000
124@@ -3,8 +3,8 @@
125 endif
126
127 nodist_libgtest_grail_a_SOURCES = \
128- $(GTEST_SOURCE)/src/gtest-all.cc \
129- $(GTEST_SOURCE)/src/gtest_main.cc
130+ $(GTEST_SOURCE)/gtest-all.cc \
131+ $(GTEST_SOURCE)/gtest_main.cc
132
133 libgtest_grail_a_CPPFLAGS = \
134 $(GTEST_CPPFLAGS)
135
136=== modified file 'test/integration/x11/timeout.cpp'
137--- test/integration/x11/timeout.cpp 2012-12-04 11:32:11 +0000
138+++ test/integration/x11/timeout.cpp 2016-01-25 18:38:26 +0000
139@@ -54,7 +54,7 @@
140
141 /* Manually specify the drag timeout in case the default changes in the
142 * future. */
143-const uint64_t DRAG_TIMEOUT = 300;
144+const uint64_t DRAG_TIMEOUT = 0;
145
146 } // namespace
147

Subscribers

People subscribed via source and target branches