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

Proposed by Timo Kluck
Status: Superseded
Proposed branch: lp:~tkluck/grail/coordinate-transform
Merge into: lp:grail
Diff against target: 29 lines (+11/-0)
2 files modified
include/grail.h (+5/-0)
src/grail-api.c (+6/-0)
To merge this branch: bzr merge lp:~tkluck/grail/coordinate-transform
Reviewer Review Type Date Requested Status
Chase Douglas (community) Disapprove
Review via email: mp+73308@code.launchpad.net

This proposal has been superseded by a proposal from 2011-08-30.

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

Small note: I don't think the callback needs to be in a new deprecated api section. You can add it just below grail_get_contact_frame() in grail.h.

The changes use malloc to allocate memory. malloc is not signal context safe (see "safe functions" in the signal(2) manpage). You probably aren't aware, or might have forgotten if you were (I almost forgot :), that X input module event handling is run in signal context. If we were to merge this code, we would find it works just fine on many machines, usually fine but occasionally crashy on some machines, and very crashy on other machines. It's a very indeterminate bug, and very difficult to try to figure out!

I'm not sure how to get around this. You could try alloca, but it's not an officially "safe" function to call in signal context, and in general alloca use is frowned upon. You could try to compile it with c99 standard variable length arrays, but I don't know if that's safe either, and we would have to switch grail to a c99 library. Alternatively, you could allocate a constant number of touches, but there's no bounds on how many touches there might actually be. If you set it to 10 touches and then ran it on a 20 touch monitor and touched with 11 touches you would crash.

This all begins to feel like this isn't the best place to implement the transformation. Perhaps the transformation should be called from within utouch-frame instead.

I really appreciate the thought and effort you put into this! I don't want you to be discouraged by my disapproval, especially since it is likely due to something you weren't aware of. I look forward to reviewing another iteration of changes :).

review: Disapprove
169. By Timo Kluck

moved coordinate transformation to utouch-frame

170. By Timo Kluck

Bump version (note API extension)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/grail.h'
2--- include/grail.h 2011-05-18 16:41:41 +0000
3+++ include/grail.h 2011-08-30 15:14:00 +0000
4@@ -468,6 +468,11 @@
5
6 #endif
7
8+void GRAIL_PUBLIC grail_set_coordinate_transform_callback(struct grail *ge,
9+ utouch_coordinate_transform_cb callback,
10+ void *user_data);
11+
12+
13 #ifdef __cplusplus
14 }
15 #endif
16
17=== modified file 'src/grail-api.c'
18--- src/grail-api.c 2011-08-09 10:03:32 +0000
19+++ src/grail-api.c 2011-08-30 15:14:00 +0000
20@@ -321,3 +321,9 @@
21
22 return count > 0 ? count : ret;
23 }
24+
25+void GRAIL_PUBLIC grail_set_coordinate_transform_callback(struct grail *ge,
26+ utouch_coordinate_transform_cb callback,
27+ void *user_data) {
28+ utouch_frame_set_coordinate_transform_callback(ge->impl->fh, callback, user_data);
29+}

Subscribers

People subscribed via source and target branches