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
=== modified file 'configure.ac'
--- configure.ac 2010-11-08 19:46:42 +0000
+++ configure.ac 2010-11-17 16:34:51 +0000
@@ -1,7 +1,7 @@
1# Initialize Autoconf1# Initialize Autoconf
2AC_PREREQ([2.60])2AC_PREREQ([2.60])
3AC_INIT([Gesture Recognition And Instantiation Library],3AC_INIT([Gesture Recognition And Instantiation Library],
4 [1.0.16],4 [1.0.17],
5 [],5 [],
6 [utouch-grail])6 [utouch-grail])
7AC_CONFIG_SRCDIR([Makefile.am])7AC_CONFIG_SRCDIR([Makefile.am])
88
=== modified file 'src/grail-api.c'
--- src/grail-api.c 2010-10-28 14:02:38 +0000
+++ src/grail-api.c 2010-11-17 16:34:51 +0000
@@ -36,10 +36,6 @@
36 struct grail *ge = dev->priv;36 struct grail *ge = dev->priv;
37 struct grail_impl *x = ge->impl;37 struct grail_impl *x = ge->impl;
38 if (ev->type == EV_ABS) {38 if (ev->type == EV_ABS) {
39 if (ev->code == ABS_X)
40 x->pointer_x = ev->value;
41 if (ev->code == ABS_Y)
42 x->pointer_y = ev->value;
43 return;39 return;
44 }40 }
45 if (ev->type == EV_KEY) {41 if (ev->type == EV_KEY) {
@@ -80,6 +76,60 @@
80 impl->report_status = 0;76 impl->report_status = 0;
81}77}
8278
79#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
80
81static int getabs(struct input_absinfo *abs, int key, int fd)
82{
83 int rc;
84 SYSCALL(rc = ioctl(fd, EVIOCGABS(key), abs));
85 return rc >= 0;
86}
87
88static void set_emulation_caps(struct grail_impl *impl, int fd)
89{
90 struct touch_caps *emu = &impl->emu;
91 struct input_absinfo info;
92
93 memset(emu, 0, sizeof(*emu));
94
95 if (getabs(&info, ABS_X, fd)) {
96 emu->min_x = info.minimum;
97 emu->max_x = info.maximum;
98 }
99 if (getabs(&info, ABS_Y, fd)) {
100 emu->min_y = info.minimum;
101 emu->max_y = info.maximum;
102 }
103}
104
105static void set_pointer(struct grail_impl *impl)
106{
107 struct touch_dev *dev = &impl->dev;
108 struct touch_caps *caps = &dev->caps;
109 struct touch_caps *emu = &impl->emu;
110 struct touch_frame *frame = &dev->frame;
111 int best_x, best_y, best_d = -1;
112 int i;
113
114 for (i = 0; i < frame->nactive; i++) {
115 struct touch *t = frame->active[i];
116 float u = (t->x - caps->min_x) / (caps->max_x - caps->min_x);
117 float v = (t->y - caps->min_y) / (caps->max_y - caps->min_y);
118 int x = emu->min_x + u * (emu->max_x - emu->min_x);
119 int y = emu->min_y + v * (emu->max_y - emu->min_y);
120 int d = abs(x - impl->pointer_x) + abs(y - impl->pointer_y);
121 if (best_d < 0 || d < best_d) {
122 best_x = x;
123 best_y = y;
124 best_d = d;
125 }
126 }
127 if (best_d >= 0) {
128 impl->pointer_x = best_x;
129 impl->pointer_y = best_y;
130 }
131}
132
83static void handle_abs_events(struct grail *ge, const struct input_event *syn)133static void handle_abs_events(struct grail *ge, const struct input_event *syn)
84{134{
85 static const int fm_mask = 0x03;135 static const int fm_mask = 0x03;
@@ -95,6 +145,7 @@
95 int ishold = pointer && tap->active && !used_move;145 int ishold = pointer && tap->active && !used_move;
96 int istap = gru->tapping.tap == 1 && !used_tap;146 int istap = gru->tapping.tap == 1 && !used_tap;
97147
148 set_pointer(impl);
98 if (!impl->pointer_status && pointer) {149 if (!impl->pointer_status && pointer) {
99 impl->report_x = impl->pointer_x;150 impl->report_x = impl->pointer_x;
100 impl->report_y = impl->pointer_y;151 impl->report_y = impl->pointer_y;
@@ -175,6 +226,7 @@
175 ret = touch_dev_open(&x->dev, fd);226 ret = touch_dev_open(&x->dev, fd);
176 if (ret)227 if (ret)
177 goto freemem;228 goto freemem;
229 set_emulation_caps(x, fd);
178 x->dev.event = tp_event;230 x->dev.event = tp_event;
179 x->dev.sync = tp_sync;231 x->dev.sync = tp_sync;
180 x->dev.priv = ge;232 x->dev.priv = ge;
181233
=== modified file 'src/grail-impl.h'
--- src/grail-impl.h 2010-09-21 11:25:43 +0000
+++ src/grail-impl.h 2010-11-17 16:34:51 +0000
@@ -28,6 +28,7 @@
2828
29struct grail_impl {29struct grail_impl {
30 struct touch_dev dev;30 struct touch_dev dev;
31 struct touch_caps emu;
31 struct evbuf evbuf;32 struct evbuf evbuf;
32 int filter_abs;33 int filter_abs;
33 int pointer_status;34 int pointer_status;

Subscribers

People subscribed via source and target branches

to all changes: