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
=== modified file 'm4/xorg-gtest.m4'
--- m4/xorg-gtest.m4 2012-12-06 15:49:37 +0000
+++ m4/xorg-gtest.m4 2016-01-25 18:38:26 +0000
@@ -1,4 +1,4 @@
1# serial 31# serial 9
22
3# Copyright (C) 2012 Canonical, Ltd.3# Copyright (C) 2012 Canonical, Ltd.
4#4#
@@ -32,16 +32,17 @@
32# Both default actions are no-ops.32# Both default actions are no-ops.
33AC_DEFUN([CHECK_XORG_GTEST],33AC_DEFUN([CHECK_XORG_GTEST],
34[34[
35 AC_REQUIRE([CHECK_GTEST])
36
37 PKG_CHECK_EXISTS([xorg-gtest],35 PKG_CHECK_EXISTS([xorg-gtest],
38 [have_xorg_gtest=yes],36 [have_xorg_gtest=yes],
39 [have_xorg_gtest=no])37 [have_xorg_gtest=no])
4038
41 XORG_GTEST_SOURCE=`$PKG_CONFIG --variable=sourcedir --print-errors xorg-gtest`39 XORG_GTEST_SOURCE=`$PKG_CONFIG --variable=sourcedir --print-errors xorg-gtest`
40 GTEST_SOURCE="$XORG_GTEST_SOURCE/src/gtest"
41 GTEST_CPPFLAGS="-I$XORG_GTEST_SOURCE/src/gtest/include -I$XORG_GTEST_SOURCE/src/gtest"
42 XORG_GTEST_CPPFLAGS=`$PKG_CONFIG --variable=CPPflags --print-errors xorg-gtest`42 XORG_GTEST_CPPFLAGS=`$PKG_CONFIG --variable=CPPflags --print-errors xorg-gtest`
43 XORG_GTEST_CPPFLAGS="$GTEST_CPPFLAGS $XORG_GTEST_CPPFLAGS"43 XORG_GTEST_CPPFLAGS="$GTEST_CPPFLAGS $XORG_GTEST_CPPFLAGS"
44 XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -I$XORG_GTEST_SOURCE"44 XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -I$XORG_GTEST_SOURCE"
45 XORG_GTEST_LDFLAGS="-lpthread -lX11 -lXi"
4546
46 PKG_CHECK_MODULES(X11, [x11], [have_x11=yes], [have_x11=no])47 PKG_CHECK_MODULES(X11, [x11], [have_x11=yes], [have_x11=no])
4748
@@ -63,12 +64,12 @@
63 AS_IF([test "x$have_xorg_gtest_evemu" = xyes],64 AS_IF([test "x$have_xorg_gtest_evemu" = xyes],
64 [XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -DHAVE_EVEMU"])65 [XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -DHAVE_EVEMU"])
6566
66 AS_IF([test "x$have_gtest" != xyes -o "x$have_x11" != xyes],
67 [have_xorg_gtest=no])
68
69 AS_IF([test "x$have_xorg_gtest" = xyes],67 AS_IF([test "x$have_xorg_gtest" = xyes],
68 [AC_SUBST(GTEST_SOURCE)]
69 [AC_SUBST(GTEST_CPPFLAGS)]
70 [AC_SUBST(XORG_GTEST_SOURCE)]70 [AC_SUBST(XORG_GTEST_SOURCE)]
71 [AC_SUBST(XORG_GTEST_CPPFLAGS)]71 [AC_SUBST(XORG_GTEST_CPPFLAGS)]
72 [AC_SUBST(XORG_GTEST_LDFLAGS)]
7273
73 # Get BASE_CXXFLAGS and STRICT_CXXFLAGS74 # Get BASE_CXXFLAGS and STRICT_CXXFLAGS
74 [XORG_MACROS_VERSION(1.17)]75 [XORG_MACROS_VERSION(1.17)]
7576
=== modified file 'src/subscription.cpp'
--- src/subscription.cpp 2012-06-21 20:30:14 +0000
+++ src/subscription.cpp 2016-01-25 18:38:26 +0000
@@ -104,10 +104,7 @@
104 }104 }
105105
106 case UGSubscriptionPropertyDragTimeout: {106 case UGSubscriptionPropertyDragTimeout: {
107 uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);107 drag_.timeout = *reinterpret_cast<const uint64_t*>(value);
108 if (timeout < 0)
109 return UGStatusErrorInvalidValue;
110 drag_.timeout = timeout;
111 return UGStatusSuccess;108 return UGStatusSuccess;
112 }109 }
113110
@@ -120,10 +117,7 @@
120 }117 }
121118
122 case UGSubscriptionPropertyPinchTimeout: {119 case UGSubscriptionPropertyPinchTimeout: {
123 uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);120 pinch_.timeout = *reinterpret_cast<const uint64_t*>(value);
124 if (timeout < 0)
125 return UGStatusErrorInvalidValue;
126 pinch_.timeout = timeout;
127 return UGStatusSuccess;121 return UGStatusSuccess;
128 }122 }
129123
@@ -136,10 +130,7 @@
136 }130 }
137131
138 case UGSubscriptionPropertyRotateTimeout: {132 case UGSubscriptionPropertyRotateTimeout: {
139 uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);133 rotate_.timeout = *reinterpret_cast<const uint64_t*>(value);
140 if (timeout < 0)
141 return UGStatusErrorInvalidValue;
142 rotate_.timeout = timeout;
143 return UGStatusSuccess;134 return UGStatusSuccess;
144 }135 }
145136
@@ -152,10 +143,7 @@
152 }143 }
153144
154 case UGSubscriptionPropertyTapTimeout: {145 case UGSubscriptionPropertyTapTimeout: {
155 uint64_t timeout = *reinterpret_cast<const uint64_t*>(value);146 tap_.timeout = *reinterpret_cast<const uint64_t*>(value);
156 if (timeout < 0)
157 return UGStatusErrorInvalidValue;
158 tap_.timeout = timeout;
159 return UGStatusSuccess;147 return UGStatusSuccess;
160 }148 }
161149
162150
=== modified file 'src/subscription.h'
--- src/subscription.h 2012-11-21 13:20:10 +0000
+++ src/subscription.h 2016-01-25 18:38:26 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * grail - Multitouch Gesture Recognition Library3 * grail - Multitouch Gesture Recognition Library
4 *4 *
5 * Copyright (C) 2011-2012 Canonical Ltd.5 * Copyright (C) 2011-2012,2016 Canonical Ltd.
6 *6 *
7 * This library is free software: you can redistribute it and/or modify it 7 * This library is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License version 38 * under the terms of the GNU Lesser General Public License version 3
@@ -33,7 +33,7 @@
33 public:33 public:
3434
35 struct Limit {35 struct Limit {
36 float timeout;36 uint64_t timeout;
37 float threshold;37 float threshold;
38 };38 };
3939
4040
=== modified file 'test/gtest/Makefile.am'
--- test/gtest/Makefile.am 2012-07-03 22:20:38 +0000
+++ test/gtest/Makefile.am 2016-01-25 18:38:26 +0000
@@ -3,8 +3,8 @@
3endif3endif
44
5nodist_libgtest_grail_a_SOURCES = \5nodist_libgtest_grail_a_SOURCES = \
6 $(GTEST_SOURCE)/src/gtest-all.cc \6 $(GTEST_SOURCE)/gtest-all.cc \
7 $(GTEST_SOURCE)/src/gtest_main.cc7 $(GTEST_SOURCE)/gtest_main.cc
88
9libgtest_grail_a_CPPFLAGS = \9libgtest_grail_a_CPPFLAGS = \
10 $(GTEST_CPPFLAGS)10 $(GTEST_CPPFLAGS)
1111
=== modified file 'test/integration/x11/timeout.cpp'
--- test/integration/x11/timeout.cpp 2012-12-04 11:32:11 +0000
+++ test/integration/x11/timeout.cpp 2016-01-25 18:38:26 +0000
@@ -54,7 +54,7 @@
5454
55/* Manually specify the drag timeout in case the default changes in the55/* Manually specify the drag timeout in case the default changes in the
56 * future. */56 * future. */
57const uint64_t DRAG_TIMEOUT = 300;57const uint64_t DRAG_TIMEOUT = 0;
5858
59} // namespace59} // namespace
6060

Subscribers

People subscribed via source and target branches