This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 7b23123f57a91074e51df400c9a0a8bee83c69e0 (commit) from a9486419936ccda09e41e401ae9481915aeb8ec8 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/7b23123f57a91074e51df400c9a0a8bee83c6...
commit 7b23123f57a91074e51df400c9a0a8bee83c69e0 Author: Cyril Hrubis metan@ucw.cz Date: Mon Feb 27 13:35:58 2012 +0000
input: Another round of abs event fixes.
diff --git a/include/input/GP_InputDriverLinux.h b/include/input/GP_InputDriverLinux.h index 4f7283f..56aef23 100644 --- a/include/input/GP_InputDriverLinux.h +++ b/include/input/GP_InputDriverLinux.h @@ -50,7 +50,8 @@ typedef struct GP_InputDriverLinux { int abs_y_max; int abs_press_max;
- uint8_t abs_flag:1; + uint8_t abs_flag_x:1; + uint8_t abs_flag_y:1; uint8_t abs_pen_flag:1; } GP_InputDriverLinux;
diff --git a/libs/input/GP_Event.c b/libs/input/GP_Event.c index e223ab3..fb8c7d8 100644 --- a/libs/input/GP_Event.c +++ b/libs/input/GP_Event.c @@ -253,11 +253,16 @@ void GP_EventPushAbs(uint32_t x, uint32_t y, uint32_t pressure, set_time(time);
- /* set global cursor, pressure == 0 is penup */ - if (pressure != 0) { + /* + * Set global cursor, the packet could be partial, eg. update only x or + * only y. In such case x_max or y_max is zero. + */ + + if (x_max != 0) cur_state.cursor_x = x * (screen_w - 1) / x_max; + + if (y_max != 0) cur_state.cursor_y = y * (screen_h - 1) / y_max; - }
/* put it into queue */ event_put(&cur_state); diff --git a/libs/input/GP_InputDriverLinux.c b/libs/input/GP_InputDriverLinux.c index f140d9e..fe514c1 100644 --- a/libs/input/GP_InputDriverLinux.c +++ b/libs/input/GP_InputDriverLinux.c @@ -138,8 +138,9 @@ struct GP_InputDriverLinux *GP_InputDriverLinuxOpen(const char *path) ret->abs_x = 0; ret->abs_y = 0; ret->abs_press = 0; - ret->abs_flag = 0; - ret->abs_pen_flag = 0; + ret->abs_flag_x = 0; + ret->abs_flag_y = 0; + ret->abs_pen_flag = 1;
try_load_callibration(ret);
@@ -180,17 +181,16 @@ static void input_abs(struct GP_InputDriverLinux *self, struct input_event *ev) switch (ev->code) { case ABS_X: self->abs_x = ev->value; - self->abs_flag = 1; + self->abs_flag_x = 1; GP_DEBUG(4, "ABS X %i", ev->value); break; case ABS_Y: self->abs_y = ev->value; - self->abs_flag = 1; + self->abs_flag_y = 1; GP_DEBUG(4, "ABS Y %i", ev->value); break; case ABS_PRESSURE: self->abs_press = ev->value; - self->abs_flag = 1; break; default: GP_DEBUG(3, "Unhandled code %i", ev->code); @@ -224,26 +224,40 @@ static void do_sync(struct GP_InputDriverLinux *self) self->rel_y = 0; }
- if (self->abs_flag) { - self->abs_flag = 0; - - if (self->abs_x > self->abs_x_max) - self->abs_x = self->abs_x_max; - - if (self->abs_y > self->abs_y_max) - self->abs_y = self->abs_y_max; + if (self->abs_flag_x || self->abs_flag_y) { + uint32_t x = 0, y = 0, x_max = 0, y_max = 0; + + if (self->abs_flag_x) { + /* clipping */ + if (self->abs_x > self->abs_x_max) + self->abs_x = self->abs_x_max; - if (self->abs_x < 0) - self->abs_x = 0; + if (self->abs_x < 0) + self->abs_x = 0; + + x = self->abs_x; + x_max = self->abs_x_max; + + self->abs_flag_x = 0; + } + + if (self->abs_flag_y) { + /* clipping */ + if (self->abs_y > self->abs_y_max) + self->abs_y = self->abs_y_max; - if (self->abs_y < 0) - self->abs_y = 0; + if (self->abs_y < 0) + self->abs_y = 0; + + y = self->abs_y; + y_max = self->abs_y_max; + + self->abs_flag_y = 0; + }
- GP_EventPushAbs(self->abs_x, self->abs_y, self->abs_press, - self->abs_x_max, self->abs_y_max, + GP_EventPushAbs(x, y, self->abs_press, x_max, y_max, self->abs_press_max, NULL); - self->abs_x = 0; - self->abs_y = 0; + self->abs_press = 0;
if (self->abs_pen_flag) {
-----------------------------------------------------------------------
Summary of changes: include/input/GP_InputDriverLinux.h | 3 +- libs/input/GP_Event.c | 11 +++++-- libs/input/GP_InputDriverLinux.c | 56 ++++++++++++++++++++++------------- 3 files changed, 45 insertions(+), 25 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.