Merge lp:~oif-team/grail/trunk.v1.0.17 into lp:grail

Proposed by Henrik Rydberg
Status: Merged
Merged at revision: 102
Proposed branch: lp:~oif-team/grail/trunk.v1.0.17
Merge into: lp:grail
Diff against target: 116 lines (+58/-5)
3 files modified
configure.ac (+1/-1)
src/grail-api.c (+56/-4)
src/grail-impl.h (+1/-0)
To merge this branch: bzr merge lp:~oif-team/grail/trunk.v1.0.17
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Review via email: mp+41067@code.launchpad.net

Description of the change

Alright, last trim patch before starting the real work for natty. No SRU or anything.

To post a comment you must log in.
Revision history for this message
Henrik Rydberg (rydberg) wrote :

The patch is a month old, and looking through it, I see things might turn up a bit differently a couple of weeks from now... So, either way is fine.

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

I don't have any problems with this, but I also think this won't go into Maverick and Natty grail will not need to deal with pointer emulation. I'll approve it and leave the decision up to you.

review: Approve
Revision history for this message
Duncan McGreggor (oubiwann) wrote :

On Wed, Nov 17, 2010 at 9:37 AM, Henrik Rydberg <email address hidden> wrote:
> The patch is a month old

Wow, kinda uncool that you never got a response back on it :-( If you
run into this again, be sure to ping someone. Or ping me: I'll sick
someone on the review :-)

Revision history for this message
Henrik Rydberg (rydberg) wrote :

Thanks - I actually did get response back then, and we decided to leave it for later, and for natty only. That's where we are now. :-)

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 2010-11-08 19:46:42 +0000
3+++ configure.ac 2010-11-17 16:34:51 +0000
4@@ -1,7 +1,7 @@
5 # Initialize Autoconf
6 AC_PREREQ([2.60])
7 AC_INIT([Gesture Recognition And Instantiation Library],
8- [1.0.16],
9+ [1.0.17],
10 [],
11 [utouch-grail])
12 AC_CONFIG_SRCDIR([Makefile.am])
13
14=== modified file 'src/grail-api.c'
15--- src/grail-api.c 2010-10-28 14:02:38 +0000
16+++ src/grail-api.c 2010-11-17 16:34:51 +0000
17@@ -36,10 +36,6 @@
18 struct grail *ge = dev->priv;
19 struct grail_impl *x = ge->impl;
20 if (ev->type == EV_ABS) {
21- if (ev->code == ABS_X)
22- x->pointer_x = ev->value;
23- if (ev->code == ABS_Y)
24- x->pointer_y = ev->value;
25 return;
26 }
27 if (ev->type == EV_KEY) {
28@@ -80,6 +76,60 @@
29 impl->report_status = 0;
30 }
31
32+#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
33+
34+static int getabs(struct input_absinfo *abs, int key, int fd)
35+{
36+ int rc;
37+ SYSCALL(rc = ioctl(fd, EVIOCGABS(key), abs));
38+ return rc >= 0;
39+}
40+
41+static void set_emulation_caps(struct grail_impl *impl, int fd)
42+{
43+ struct touch_caps *emu = &impl->emu;
44+ struct input_absinfo info;
45+
46+ memset(emu, 0, sizeof(*emu));
47+
48+ if (getabs(&info, ABS_X, fd)) {
49+ emu->min_x = info.minimum;
50+ emu->max_x = info.maximum;
51+ }
52+ if (getabs(&info, ABS_Y, fd)) {
53+ emu->min_y = info.minimum;
54+ emu->max_y = info.maximum;
55+ }
56+}
57+
58+static void set_pointer(struct grail_impl *impl)
59+{
60+ struct touch_dev *dev = &impl->dev;
61+ struct touch_caps *caps = &dev->caps;
62+ struct touch_caps *emu = &impl->emu;
63+ struct touch_frame *frame = &dev->frame;
64+ int best_x, best_y, best_d = -1;
65+ int i;
66+
67+ for (i = 0; i < frame->nactive; i++) {
68+ struct touch *t = frame->active[i];
69+ float u = (t->x - caps->min_x) / (caps->max_x - caps->min_x);
70+ float v = (t->y - caps->min_y) / (caps->max_y - caps->min_y);
71+ int x = emu->min_x + u * (emu->max_x - emu->min_x);
72+ int y = emu->min_y + v * (emu->max_y - emu->min_y);
73+ int d = abs(x - impl->pointer_x) + abs(y - impl->pointer_y);
74+ if (best_d < 0 || d < best_d) {
75+ best_x = x;
76+ best_y = y;
77+ best_d = d;
78+ }
79+ }
80+ if (best_d >= 0) {
81+ impl->pointer_x = best_x;
82+ impl->pointer_y = best_y;
83+ }
84+}
85+
86 static void handle_abs_events(struct grail *ge, const struct input_event *syn)
87 {
88 static const int fm_mask = 0x03;
89@@ -95,6 +145,7 @@
90 int ishold = pointer && tap->active && !used_move;
91 int istap = gru->tapping.tap == 1 && !used_tap;
92
93+ set_pointer(impl);
94 if (!impl->pointer_status && pointer) {
95 impl->report_x = impl->pointer_x;
96 impl->report_y = impl->pointer_y;
97@@ -175,6 +226,7 @@
98 ret = touch_dev_open(&x->dev, fd);
99 if (ret)
100 goto freemem;
101+ set_emulation_caps(x, fd);
102 x->dev.event = tp_event;
103 x->dev.sync = tp_sync;
104 x->dev.priv = ge;
105
106=== modified file 'src/grail-impl.h'
107--- src/grail-impl.h 2010-09-21 11:25:43 +0000
108+++ src/grail-impl.h 2010-11-17 16:34:51 +0000
109@@ -28,6 +28,7 @@
110
111 struct grail_impl {
112 struct touch_dev dev;
113+ struct touch_caps emu;
114 struct evbuf evbuf;
115 int filter_abs;
116 int pointer_status;

Subscribers

People subscribed via source and target branches

to all changes: