-
- if (down == 0 || *last != 0) {
- /* key up or direction change, return up event for old key */
- ret_kc = *last;
- ret_down = 0;
- *last = 0;
+ }
+ else if (ev.type == EV_ABS)
+ {
+ int lzone = dev->abs_lzone, down = 0, *last;
+
+ // map absolute to up/down/left/right
+ if (lzone != 0 && ev.code == ABS_X) {
+ if (ev.value < dev->abs_min_x + lzone)
+ down = KEY_LEFT;
+ else if (ev.value > dev->abs_max_x - lzone)
+ down = KEY_RIGHT;
+ last = &dev->abs_lastx;
+ }
+ else if (lzone != 0 && ev.code == ABS_Y) {
+ if (ev.value < dev->abs_min_y + lzone)
+ down = KEY_UP;
+ else if (ev.value > dev->abs_max_y - lzone)
+ down = KEY_DOWN;
+ last = &dev->abs_lasty;
+ }
+ else
+ continue;
+
+ if (down == *last)
+ continue;
+
+ if (down == 0 || *last != 0) {
+ /* key up or direction change, return up event for old key */
+ ret_kc = *last;
+ ret_down = 0;
+ *last = 0;
+ goto out;
+ }
+ ret_kc = *last = down;
+ ret_down = 1;