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
1=== modified file 'configure.ac'
2--- configure.ac 2011-08-09 21:29:54 +0000
3+++ configure.ac 2011-08-31 13:19:06 +0000
4@@ -1,7 +1,7 @@
5 # Initialize Autoconf
6 AC_PREREQ([2.60])
7 AC_INIT([Touch Frame Library],
8- [1.1.4],
9+ [1.2.0],
10 [],
11 [utouch-frame])
12 AC_CONFIG_SRCDIR([Makefile.am])
13@@ -13,7 +13,7 @@
14 AM_SILENT_RULES([yes])
15 AM_MAINTAINER_MODE
16
17-LIB_VERSION=2:0:1
18+LIB_VERSION=3:0:2
19 AC_SUBST([LIB_VERSION])
20
21 # Initialize libtool
22
23=== modified file 'include/utouch/frame.h'
24--- include/utouch/frame.h 2011-05-17 14:09:11 +0000
25+++ include/utouch/frame.h 2011-08-31 13:19:06 +0000
26@@ -300,6 +300,25 @@
27 const struct utouch_frame *utouch_frame_sync(utouch_frame_handle fh,
28 utouch_frame_time_t time);
29
30+/**
31+ * utouch_coordinate_transform_cb - user-definable callback that transforms a touch point
32+ * @x: pointer to an x coordinate (in, out)
33+ * @y: pointer to a y coordinate (in, out)
34+ * @user_data: opaque pointer, passed by the user when setting the callback
35+ */
36+typedef void (*utouch_coordinate_transform_cb)(float *x, float *y, void *user_data);
37+
38+/**
39+ * utouch_frame_set_coordinate_transform_callback - set a callback to obtain a transformation
40+ * to apply to every touch point
41+ * @fh: the frame engine in use
42+ * @callback: the callback that transforms x and y
43+ * @user_data: opaque pointer to user data for the callback
44+ */
45+void utouch_frame_set_coordinate_transform_callback(utouch_frame_handle fh,
46+ utouch_coordinate_transform_cb callback,
47+ void *user_data);
48+
49 #ifdef __cplusplus
50 }
51 #endif
52
53=== modified file 'src/frame-impl.h'
54--- src/frame-impl.h 2011-05-17 14:09:11 +0000
55+++ src/frame-impl.h 2011-08-31 13:19:06 +0000
56@@ -36,6 +36,8 @@
57 int *evmap;
58 float map[9];
59 unsigned int semi_mt_num_active;
60+ utouch_coordinate_transform_cb coordinate_transform;
61+ void *coordinate_transform_user_data;
62 };
63
64 #endif
65
66=== modified file 'src/frame.c'
67--- src/frame.c 2011-08-09 19:22:39 +0000
68+++ src/frame.c 2011-08-31 13:19:06 +0000
69@@ -236,14 +236,19 @@
70 return -ENOMEM;
71 }
72
73-static void transform_slot(struct utouch_contact *slot,
74- const struct utouch_surface *s)
75+static void transform_slot(utouch_frame_handle fh,
76+ struct utouch_contact *slot)
77 {
78+ const struct utouch_surface *s = fh->surface;
79 float fx = (s->mapped_max_x - s->mapped_min_x) / (s->max_x - s->min_x);
80 float fy = (s->mapped_max_y - s->mapped_min_y) / (s->max_y - s->min_y);
81 /* assume clipped view for asymmetrical scaling */
82 float f = MAX(fx, fy);
83
84+ if(fh->coordinate_transform) {
85+ fh->coordinate_transform(&slot->x, &slot->y, fh->coordinate_transform_user_data);
86+ }
87+
88 slot->x = fx * (slot->x - s->min_x) + s->mapped_min_x;
89 slot->y = fy * (slot->y - s->min_y) + s->mapped_min_y;
90 slot->touch_major *= f;
91@@ -279,7 +284,7 @@
92 a->pressure = b->pressure;
93 a->distance = b->distance;
94
95- transform_slot(a, s);
96+ transform_slot(fh, a);
97
98 if (a->active && ap->active && a->id == ap->id) {
99 a->x += b->vx * dt;
100@@ -406,3 +411,11 @@
101
102 return frame;
103 }
104+
105+void utouch_frame_set_coordinate_transform_callback(utouch_frame_handle fh,
106+ utouch_coordinate_transform_cb callback,
107+ void *user_data)
108+{
109+ fh->coordinate_transform = callback;
110+ fh->coordinate_transform_user_data = user_data;
111+}
112
113=== modified file 'src/libutouch-frame.ver'
114--- src/libutouch-frame.ver 2011-06-14 13:27:45 +0000
115+++ src/libutouch-frame.ver 2011-08-31 13:19:06 +0000
116@@ -1,4 +1,4 @@
117-UTOUCH_FRAME_1.1 {
118+UTOUCH_FRAME_1.2 {
119 global:
120 utouch_frame_configure_xi2;
121 utouch_frame_delete_engine;
122@@ -14,6 +14,7 @@
123 utouch_frame_new_engine_raw;
124 utouch_frame_pump_mtdev;
125 utouch_frame_pump_xi2;
126+ utouch_frame_set_coordinate_transform_callback;
127
128 local:
129 *;

Subscribers

People subscribed via source and target branches