summaryrefslogtreecommitdiff
path: root/src/grail-api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/grail-api.c')
-rw-r--r--src/grail-api.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/grail-api.c b/src/grail-api.c
index d4ad83d..b7d1ce0 100644
--- a/src/grail-api.c
+++ b/src/grail-api.c
@@ -62,6 +62,24 @@ static void evput(struct grail_impl *x, struct timeval time,
62 evbuf_put(&x->evbuf, &ev); 62 evbuf_put(&x->evbuf, &ev);
63} 63}
64 64
65static void report_down(struct grail_impl *impl)
66{
67 if (impl->report_status)
68 return;
69 evput(impl, impl->report_time, EV_KEY, BTN_TOUCH, 1);
70 evput(impl, impl->report_time, EV_ABS, ABS_X, impl->report_x);
71 evput(impl, impl->report_time, EV_ABS, ABS_Y, impl->report_y);
72 impl->report_status = 1;
73}
74
75static void report_up(struct grail_impl *impl, const struct input_event *syn)
76{
77 if (!impl->report_status)
78 return;
79 evput(impl, syn->time, EV_KEY, BTN_TOUCH, 0);
80 impl->report_status = 0;
81}
82
65static void handle_abs_events(struct grail *ge, const struct input_event *syn) 83static void handle_abs_events(struct grail *ge, const struct input_event *syn)
66{ 84{
67 static const int fm_mask = 0x03; 85 static const int fm_mask = 0x03;
@@ -75,9 +93,12 @@ static void handle_abs_events(struct grail *ge, const struct input_event *syn)
75 int ishold = move->single && tap->active && !used_move; 93 int ishold = move->single && tap->active && !used_move;
76 int pointer = ismove || ishold; 94 int pointer = ismove || ishold;
77 95
78 if (pointer != impl->pointer_status) { 96 if (!impl->pointer_status && pointer) {
79 evput(impl, syn->time, EV_KEY, BTN_TOUCH, pointer); 97 impl->report_x = impl->pointer_x;
80 impl->pointer_status = pointer; 98 impl->report_y = impl->pointer_y;
99 impl->report_time = syn->time;
100 impl->pointer_status = 1;
101 report_down(impl);
81 } 102 }
82 if (pointer) { 103 if (pointer) {
83 if (impl->report_x != impl->pointer_x) { 104 if (impl->report_x != impl->pointer_x) {
@@ -89,6 +110,10 @@ static void handle_abs_events(struct grail *ge, const struct input_event *syn)
89 impl->report_y = impl->pointer_y; 110 impl->report_y = impl->pointer_y;
90 } 111 }
91 } 112 }
113 if (impl->pointer_status && !pointer) {
114 impl->pointer_status = 0;
115 report_up(impl, syn);
116 }
92} 117}
93 118
94static void tp_sync(struct touch_dev *dev, 119static void tp_sync(struct touch_dev *dev,