Merge lp:~dandrader/frame/missing_backend_funcs into lp:frame

Proposed by Daniel d'Andrada
Status: Needs review
Proposed branch: lp:~dandrader/frame/missing_backend_funcs
Merge into: lp:frame
Diff against target: 240 lines (+116/-1)
9 files modified
configure.ac (+1/-1)
debian/changelog (+7/-0)
debian/libframe6.symbols (+4/-0)
include/oif/frame_backend.h (+30/-0)
src/frame.cpp (+23/-0)
src/frame.h (+1/-0)
src/libframe.ver (+7/-0)
src/touch.cpp (+12/-0)
test/regular/backend.cpp (+31/-0)
To merge this branch: bzr merge lp:~dandrader/frame/missing_backend_funcs
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Open Input Framework Team Pending
Review via email: mp+139447@code.launchpad.net

Commit message

Add some missing functions to frame_backend.h

Namely frame_backend_frame_borrow_touch_by_index(),
frame_backend_touch_set_window_x() and frame_backend_touch_set_window_x().

The later two were added so that we can set the window coordinates independently.
We had only frame_backend_touch_set_window_pos(touch, x, y).

Description of the change

Add some missing functions to frame_backend.h

Namely frame_backend_frame_borrow_touch_by_index(), frame_backend_touch_set_window_x() and frame_backend_touch_set_window_x().

The later two were added so that we can set the window coordinates independently. We had only frame_backend_touch_set_window_pos(touch, x, y).

To post a comment you must log in.
120. By Daniel d'Andrada

Update debian/libframe6.symbols

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

Unmerged revisions

120. By Daniel d'Andrada

Update debian/libframe6.symbols

119. By Daniel d'Andrada

Added frame_backend_frame_borrow_touch_by_index()

118. By Daniel d'Andrada

Added frame_backend_touch_set_window_x() and [...]_y()

So that we can set the window coordinates independently.
We had only frame_backend_touch_set_window_pos(touch, x, y), and it's not
uncommon for events out of /dev/event/input* to update only one coordinate
(i.e. only one coordinate between EV_SYNCs)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2012-12-04 18:46:01 +0000
+++ configure.ac 2012-12-12 11:49:20 +0000
@@ -1,7 +1,7 @@
1# Initialize Autoconf1# Initialize Autoconf
2AC_PREREQ([2.60])2AC_PREREQ([2.60])
3AC_INIT([Touch Frame Library],3AC_INIT([Touch Frame Library],
4 [2.5.0],4 [2.6.0],
5 [],5 [],
6 [frame])6 [frame])
7AC_CONFIG_SRCDIR([Makefile.am])7AC_CONFIG_SRCDIR([Makefile.am])
88
=== modified file 'debian/changelog'
--- debian/changelog 2012-12-07 06:37:45 +0000
+++ debian/changelog 2012-12-12 11:49:20 +0000
@@ -1,3 +1,10 @@
1frame (2.6.0daily12.12.11.1-0ubuntu1) UNRELEASED; urgency=low
2
3 * Added frame_backend_touch_set_window_x() and [...]_y()
4 * Added frame_backend_frame_borrow_touch_by_index()
5
6 -- Daniel d'Andrada <daniel.dandrada@canonical.com> Tue, 11 Dec 2012 12:06:51 -0200
7
1frame (2.5.0daily12.12.07.1-0ubuntu1) raring; urgency=low8frame (2.5.0daily12.12.07.1-0ubuntu1) raring; urgency=low
29
3 [ Daniel d'Andrada ]10 [ Daniel d'Andrada ]
411
=== modified file 'debian/libframe6.symbols'
--- debian/libframe6.symbols 2012-12-04 18:46:01 +0000
+++ debian/libframe6.symbols 2012-12-12 11:49:20 +0000
@@ -2,6 +2,10 @@
2 FRAME_2.2@FRAME_2.2 2.2.02 FRAME_2.2@FRAME_2.2 2.2.0
3 FRAME_2.4@FRAME_2.4 2.4.33 FRAME_2.4@FRAME_2.4 2.4.3
4 FRAME_2.5@FRAME_2.5 2.5.04 FRAME_2.5@FRAME_2.5 2.5.0
5 FRAME_2.6@FRAME_2.6 2.6.0
6 frame_backend_frame_borrow_touch_by_index@FRAME_2.6 2.6.0
7 frame_backend_touch_set_window_x@FRAME_2.6 2.6.0
8 frame_backend_touch_set_window_y@FRAME_2.6 2.6.0
5 frame_accept_touch@FRAME_2.5 2.5.09 frame_accept_touch@FRAME_2.5 2.5.0
6 frame_reject_touch@FRAME_2.5 2.5.010 frame_reject_touch@FRAME_2.5 2.5.0
7 frame_axis_get_maximum@FRAME_2.2 2.2.411 frame_axis_get_maximum@FRAME_2.2 2.2.4
812
=== modified file 'include/oif/frame_backend.h'
--- include/oif/frame_backend.h 2012-12-11 13:49:50 +0000
+++ include/oif/frame_backend.h 2012-12-12 11:49:20 +0000
@@ -175,11 +175,26 @@
175 * will be made upon the first change made to it.175 * will be made upon the first change made to it.
176 *176 *
177 * Possible errors: UFStatusErrorInvalidTouch177 * Possible errors: UFStatusErrorInvalidTouch
178 * \sa frame_backend_frame_borrow_touch_by_index
178 */179 */
179FRAME_PUBLIC180FRAME_PUBLIC
180UFStatus frame_backend_frame_borrow_touch_by_id(UFBackendFrame frame,181UFStatus frame_backend_frame_borrow_touch_by_id(UFBackendFrame frame,
181 UFTouchId id,182 UFTouchId id,
182 UFBackendTouch *touch);183 UFBackendTouch *touch);
184/**
185 * Gets a UFBackendTouch for the UFTouch in the specified index in the frame.
186 *
187 * Just like frame_backend_frame_borrow_touch_by_id, with the difference that
188 * you specify a index inside the given frame instead of the id of the touch
189 * you're interested in.
190 *
191 * Possible errors: UFStatusErrorInvalidTouch
192 * \sa frame_backend_frame_borrow_touch_by_id
193 */
194FRAME_PUBLIC
195UFStatus frame_backend_frame_borrow_touch_by_index(UFBackendFrame frame,
196 unsigned int index,
197 UFBackendTouch *touch);
183198
184/**199/**
185 * Sets the "Device" property of the given frame200 * Sets the "Device" property of the given frame
@@ -257,11 +272,26 @@
257272
258/**273/**
259 * Sets the "WindowX" and "WindowY" properties of the given touch274 * Sets the "WindowX" and "WindowY" properties of the given touch
275 * \sa frame_backend_touch_set_window_x, frame_backend_touch_set_window_y
260 */276 */
261FRAME_PUBLIC277FRAME_PUBLIC
262void frame_backend_touch_set_window_pos(UFBackendTouch touch, float x, float y);278void frame_backend_touch_set_window_pos(UFBackendTouch touch, float x, float y);
263279
264/**280/**
281 * Sets the "WindowX" property of the given touch
282 * \sa frame_backend_touch_set_window_x, frame_backend_touch_set_window_pos
283 */
284FRAME_PUBLIC
285void frame_backend_touch_set_window_x(UFBackendTouch touch, float x);
286
287/**
288 * Sets the "WindowY" property of the given touch
289 * \sa frame_backend_touch_set_window_pos, frame_backend_touch_set_window_y
290 */
291FRAME_PUBLIC
292void frame_backend_touch_set_window_y(UFBackendTouch touch, float y);
293
294/**
265 * Sets the "Time" property of the given touch295 * Sets the "Time" property of the given touch
266 */296 */
267FRAME_PUBLIC297FRAME_PUBLIC
268298
=== modified file 'src/frame.cpp'
--- src/frame.cpp 2012-08-31 19:07:05 +0000
+++ src/frame.cpp 2012-12-12 11:49:20 +0000
@@ -180,6 +180,13 @@
180 return prev_->touches_array_[it->second]->GetValue(type, value);180 return prev_->touches_array_[it->second]->GetValue(type, value);
181}181}
182182
183SharedUFTouch* UFFrame::GetSharedTouchByIndex(unsigned int index) {
184 if (index >= touches_array_.size())
185 return nullptr;
186 else
187 return &(touches_array_[index]);
188}
189
183UFStatus UFFrame::GetTouchByIndex(unsigned int index, ::UFTouch* touch) const {190UFStatus UFFrame::GetTouchByIndex(unsigned int index, ::UFTouch* touch) const {
184 if (index >= touches_array_.size())191 if (index >= touches_array_.size())
185 return UFStatusErrorInvalidTouch;192 return UFStatusErrorInvalidTouch;
@@ -367,6 +374,22 @@
367 }374 }
368}375}
369376
377UFStatus frame_backend_frame_borrow_touch_by_index(UFBackendFrame frame,
378 unsigned int index,
379 UFBackendTouch *touch)
380{
381 oif::frame::UFFrame* ufframe =
382 static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get());
383
384 oif::frame::SharedUFTouch *shared_touch = ufframe->GetSharedTouchByIndex(index);
385 if (shared_touch) {
386 *touch = new UFBackendTouch_(*shared_touch);
387 return UFStatusSuccess;
388 } else {
389 return UFStatusErrorInvalidTouch;
390 }
391}
392
370void frame_backend_frame_set_device(UFBackendFrame frame, UFBackendDevice device)393void frame_backend_frame_set_device(UFBackendFrame frame, UFBackendDevice device)
371{394{
372 static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get())->395 static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get())->
373396
=== modified file 'src/frame.h'
--- src/frame.h 2012-08-31 17:04:43 +0000
+++ src/frame.h 2012-12-12 11:49:20 +0000
@@ -58,6 +58,7 @@
58 float* value) const;58 float* value) const;
59 UFStatus GetPreviousTouchProperty(const UFTouch* touch,59 UFStatus GetPreviousTouchProperty(const UFTouch* touch,
60 UFTouchProperty property, void* value) const;60 UFTouchProperty property, void* value) const;
61 SharedUFTouch* GetSharedTouchByIndex(unsigned int index);
61 UFStatus GetTouchByIndex(unsigned int index, ::UFTouch* touch) const;62 UFStatus GetTouchByIndex(unsigned int index, ::UFTouch* touch) const;
62 SharedUFTouch* GetSharedTouchById(UFTouchId touch_id);63 SharedUFTouch* GetSharedTouchById(UFTouchId touch_id);
63 UFStatus GetTouchById(UFTouchId touch_id, ::UFTouch* touch) const;64 UFStatus GetTouchById(UFTouchId touch_id, ::UFTouch* touch) const;
6465
=== modified file 'src/libframe.ver'
--- src/libframe.ver 2012-12-04 18:46:01 +0000
+++ src/libframe.ver 2012-12-12 11:49:20 +0000
@@ -109,3 +109,10 @@
109 frame_accept_touch;109 frame_accept_touch;
110 frame_reject_touch;110 frame_reject_touch;
111} FRAME_2.4;111} FRAME_2.4;
112
113FRAME_2.6 {
114 global:
115 frame_backend_frame_borrow_touch_by_index;
116 frame_backend_touch_set_window_x;
117 frame_backend_touch_set_window_y;
118} FRAME_2.5;
112119
=== modified file 'src/touch.cpp'
--- src/touch.cpp 2012-08-31 17:04:43 +0000
+++ src/touch.cpp 2012-12-12 11:49:20 +0000
@@ -264,6 +264,18 @@
264 touch->InsertProperty(UFTouchPropertyWindowY, new oif::frame::Value(y));264 touch->InsertProperty(UFTouchPropertyWindowY, new oif::frame::Value(y));
265}265}
266266
267void frame_backend_touch_set_window_x(UFBackendTouch touch_backend, float x)
268{
269 oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
270 touch->InsertProperty(UFTouchPropertyWindowX, new oif::frame::Value(x));
271}
272
273void frame_backend_touch_set_window_y(UFBackendTouch touch_backend, float y)
274{
275 oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
276 touch->InsertProperty(UFTouchPropertyWindowY, new oif::frame::Value(y));
277}
278
267void frame_backend_touch_set_time(UFBackendTouch touch_backend, uint64_t time)279void frame_backend_touch_set_time(UFBackendTouch touch_backend, uint64_t time)
268{280{
269 oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();281 oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
270282
=== modified file 'test/regular/backend.cpp'
--- test/regular/backend.cpp 2012-08-31 19:26:43 +0000
+++ test/regular/backend.cpp 2012-12-12 11:49:20 +0000
@@ -23,6 +23,12 @@
23 ASSERT_EQ(1.2f, frame_touch_get_window_x(touch));23 ASSERT_EQ(1.2f, frame_touch_get_window_x(touch));
24 ASSERT_EQ(3.4f, frame_touch_get_window_y(touch));24 ASSERT_EQ(3.4f, frame_touch_get_window_y(touch));
2525
26 frame_backend_touch_set_window_x(touch_backend, 5.6f);
27 ASSERT_EQ(5.6f, frame_touch_get_window_x(touch));
28
29 frame_backend_touch_set_window_y(touch_backend, 7.8f);
30 ASSERT_EQ(7.8f, frame_touch_get_window_y(touch));
31
26 frame_backend_touch_set_time(touch_backend, 852);32 frame_backend_touch_set_time(touch_backend, 852);
27 ASSERT_EQ(852, frame_touch_get_time(touch));33 ASSERT_EQ(852, frame_touch_get_time(touch));
2834
@@ -191,6 +197,31 @@
191 frame_backend_frame_delete(frame_backend);197 frame_backend_frame_delete(frame_backend);
192}198}
193199
200TEST(Backend, FrameBorrowTouchByIndex)
201{
202 UFStatus status;
203
204 UFBackendFrame frame_backend = frame_backend_frame_new();
205
206 UFBackendTouch touch_backend = frame_backend_touch_new();
207 frame_backend_touch_set_id(touch_backend, 12);
208
209 status = frame_backend_frame_give_touch(frame_backend, &touch_backend);
210 ASSERT_EQ(UFStatusSuccess, status);
211
212 status = frame_backend_frame_borrow_touch_by_index(frame_backend, 0, &touch_backend);
213 ASSERT_EQ(UFStatusSuccess, status);
214
215 UFTouch touch = frame_backend_touch_get_touch(touch_backend);
216 ASSERT_EQ(12, frame_touch_get_id(touch));
217
218 status = frame_backend_frame_give_touch(frame_backend, &touch_backend);
219 ASSERT_EQ(UFStatusSuccess, status);
220
221 /* clean up */
222 frame_backend_frame_delete(frame_backend);
223}
224
194TEST(Backend, FrameCreateNext)225TEST(Backend, FrameCreateNext)
195{226{
196 UFStatus status;227 UFStatus status;

Subscribers

People subscribed via source and target branches