Merge lp:~tkluck/frame/coordinate-transform into lp:frame

Proposed by Timo Kluck
Status: Merged
Merged at revision: 42
Proposed branch: lp:~tkluck/frame/coordinate-transform
Merge into: lp:frame
Diff against target: 129 lines (+41/-6)
5 files modified
configure.ac (+2/-2)
include/utouch/frame.h (+19/-0)
src/frame-impl.h (+2/-0)
src/frame.c (+16/-3)
src/libutouch-frame.ver (+2/-1)
To merge this branch: bzr merge lp:~tkluck/frame/coordinate-transform
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
Chase Douglas (community) Approve
Review via email: mp+73390@code.launchpad.net

Description of the change

Add support for coordinate transform

To post a comment you must log in.
Revision history for this message
Chase Douglas (chasedouglas) wrote :

The code looks reasonable. I don't think there's anything else that would go into a 1.2.x api extension, so please add a commit to bump the version to 1.2.0 and tag it as v1.2.0.

Normally we ask for two utouch team members to approve of a change before merging, so I'm going to subscribe the team.

review: Approve
Revision history for this message
Timo Kluck (tkluck) wrote :

Thanks for your approval! I just bumped the version.

43. By Timo Kluck

Bump version (note API extension)

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Looks good. As I'm not an autotools expert I'm not sure what this does:

-LIB_VERSION=2:0:1
+LIB_VERSION=3:0:2

Does this bump library soname or something similar? It should not, because this is an API extension.

Revision history for this message
Stephen M. Webb (bregma) wrote :

Looks correct.

The LIB_VERSION bump is the right way to handle backwards-compatible API extensions. The SONAME remains unchanged but the minor version of the library filename will be bumped by one.

review: Approve
Revision history for this message
Chase Douglas (chasedouglas) wrote :

I realized it didn't make sense to push the branch with the tag since it hasn't been runtime tested much. The branch will build in the ppa:utouch-team/daily archive. After some testing we can release a new upstream version.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Good thing I didn't tag it because I just noticed an issue: the library version script should have been extended with a new version block instead of having the current block upgraded. I have fixed this in commit 43.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2011-08-09 21:29:54 +0000
+++ configure.ac 2011-08-31 13:19:06 +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 [1.1.4],4 [1.2.0],
5 [],5 [],
6 [utouch-frame])6 [utouch-frame])
7AC_CONFIG_SRCDIR([Makefile.am])7AC_CONFIG_SRCDIR([Makefile.am])
@@ -13,7 +13,7 @@
13AM_SILENT_RULES([yes])13AM_SILENT_RULES([yes])
14AM_MAINTAINER_MODE14AM_MAINTAINER_MODE
1515
16LIB_VERSION=2:0:116LIB_VERSION=3:0:2
17AC_SUBST([LIB_VERSION])17AC_SUBST([LIB_VERSION])
1818
19# Initialize libtool19# Initialize libtool
2020
=== modified file 'include/utouch/frame.h'
--- include/utouch/frame.h 2011-05-17 14:09:11 +0000
+++ include/utouch/frame.h 2011-08-31 13:19:06 +0000
@@ -300,6 +300,25 @@
300const struct utouch_frame *utouch_frame_sync(utouch_frame_handle fh,300const struct utouch_frame *utouch_frame_sync(utouch_frame_handle fh,
301 utouch_frame_time_t time);301 utouch_frame_time_t time);
302302
303/**
304 * utouch_coordinate_transform_cb - user-definable callback that transforms a touch point
305 * @x: pointer to an x coordinate (in, out)
306 * @y: pointer to a y coordinate (in, out)
307 * @user_data: opaque pointer, passed by the user when setting the callback
308 */
309typedef void (*utouch_coordinate_transform_cb)(float *x, float *y, void *user_data);
310
311/**
312 * utouch_frame_set_coordinate_transform_callback - set a callback to obtain a transformation
313 * to apply to every touch point
314 * @fh: the frame engine in use
315 * @callback: the callback that transforms x and y
316 * @user_data: opaque pointer to user data for the callback
317 */
318void utouch_frame_set_coordinate_transform_callback(utouch_frame_handle fh,
319 utouch_coordinate_transform_cb callback,
320 void *user_data);
321
303#ifdef __cplusplus322#ifdef __cplusplus
304}323}
305#endif324#endif
306325
=== modified file 'src/frame-impl.h'
--- src/frame-impl.h 2011-05-17 14:09:11 +0000
+++ src/frame-impl.h 2011-08-31 13:19:06 +0000
@@ -36,6 +36,8 @@
36 int *evmap;36 int *evmap;
37 float map[9];37 float map[9];
38 unsigned int semi_mt_num_active;38 unsigned int semi_mt_num_active;
39 utouch_coordinate_transform_cb coordinate_transform;
40 void *coordinate_transform_user_data;
39};41};
4042
41#endif43#endif
4244
=== modified file 'src/frame.c'
--- src/frame.c 2011-08-09 19:22:39 +0000
+++ src/frame.c 2011-08-31 13:19:06 +0000
@@ -236,14 +236,19 @@
236 return -ENOMEM;236 return -ENOMEM;
237}237}
238238
239static void transform_slot(struct utouch_contact *slot,239static void transform_slot(utouch_frame_handle fh,
240 const struct utouch_surface *s)240 struct utouch_contact *slot)
241{241{
242 const struct utouch_surface *s = fh->surface;
242 float fx = (s->mapped_max_x - s->mapped_min_x) / (s->max_x - s->min_x);243 float fx = (s->mapped_max_x - s->mapped_min_x) / (s->max_x - s->min_x);
243 float fy = (s->mapped_max_y - s->mapped_min_y) / (s->max_y - s->min_y);244 float fy = (s->mapped_max_y - s->mapped_min_y) / (s->max_y - s->min_y);
244 /* assume clipped view for asymmetrical scaling */245 /* assume clipped view for asymmetrical scaling */
245 float f = MAX(fx, fy);246 float f = MAX(fx, fy);
246247
248 if(fh->coordinate_transform) {
249 fh->coordinate_transform(&slot->x, &slot->y, fh->coordinate_transform_user_data);
250 }
251
247 slot->x = fx * (slot->x - s->min_x) + s->mapped_min_x;252 slot->x = fx * (slot->x - s->min_x) + s->mapped_min_x;
248 slot->y = fy * (slot->y - s->min_y) + s->mapped_min_y;253 slot->y = fy * (slot->y - s->min_y) + s->mapped_min_y;
249 slot->touch_major *= f;254 slot->touch_major *= f;
@@ -279,7 +284,7 @@
279 a->pressure = b->pressure;284 a->pressure = b->pressure;
280 a->distance = b->distance;285 a->distance = b->distance;
281286
282 transform_slot(a, s);287 transform_slot(fh, a);
283288
284 if (a->active && ap->active && a->id == ap->id) {289 if (a->active && ap->active && a->id == ap->id) {
285 a->x += b->vx * dt;290 a->x += b->vx * dt;
@@ -406,3 +411,11 @@
406411
407 return frame;412 return frame;
408}413}
414
415void utouch_frame_set_coordinate_transform_callback(utouch_frame_handle fh,
416 utouch_coordinate_transform_cb callback,
417 void *user_data)
418{
419 fh->coordinate_transform = callback;
420 fh->coordinate_transform_user_data = user_data;
421}
409422
=== modified file 'src/libutouch-frame.ver'
--- src/libutouch-frame.ver 2011-06-14 13:27:45 +0000
+++ src/libutouch-frame.ver 2011-08-31 13:19:06 +0000
@@ -1,4 +1,4 @@
1UTOUCH_FRAME_1.1 {1UTOUCH_FRAME_1.2 {
2 global:2 global:
3 utouch_frame_configure_xi2;3 utouch_frame_configure_xi2;
4 utouch_frame_delete_engine;4 utouch_frame_delete_engine;
@@ -14,6 +14,7 @@
14 utouch_frame_new_engine_raw;14 utouch_frame_new_engine_raw;
15 utouch_frame_pump_mtdev;15 utouch_frame_pump_mtdev;
16 utouch_frame_pump_xi2;16 utouch_frame_pump_xi2;
17 utouch_frame_set_coordinate_transform_callback;
1718
18 local:19 local:
19 *;20 *;

Subscribers

People subscribed via source and target branches