@@ -117,6 +117,7 @@ typedef struct {
117
117
int saw_pos_x ; // Did this sequence have an ABS_MT_POSITION_X?
118
118
int saw_pos_y ; // Did this sequence have an ABS_MT_POSITION_Y?
119
119
int saw_mt_report ; // Did this sequence have an SYN_MT_REPORT?
120
+ int saw_mt_tracking_id ;
120
121
int slide_right ;
121
122
int slide_left ;
122
123
point touch_min ;
@@ -204,6 +205,10 @@ static int calibrate_touch(input_device *dev) {
204
205
dev -> slot_current = 0 ;
205
206
dev -> slide_right = 0 ;
206
207
dev -> slide_left = 0 ;
208
+ dev -> saw_pos_x = 0 ;
209
+ dev -> saw_pos_y = 0 ;
210
+ dev -> saw_mt_tracking_id = 0 ;
211
+ dev -> saw_mt_report = 0 ;
207
212
208
213
memset (& info , 0 , sizeof (info ));
209
214
if (ioctl (dev -> fd , EVIOCGABS (ABS_MT_POSITION_X ), & info ) == 0 ) {
@@ -704,13 +709,15 @@ static int input_callback(int fd, short revents, void *data) {
704
709
705
710
if (ev .type == EV_SYN ) {
706
711
if (ev .code == SYN_MT_REPORT ) {
707
- if (dev .saw_pos_x && dev .saw_pos_y ) {
708
- dev .saw_pos_x = 0 ;
709
- dev .saw_pos_y = 0 ;
710
- } else
711
- handle_release (& dev , & ev );
712
+ dev .saw_mt_report = 1 ;
713
+ if (!dev .saw_mt_tracking_id ) {
714
+ if (dev .saw_pos_x && dev .saw_pos_y ) {
715
+ dev .saw_pos_x = 0 ;
716
+ dev .saw_pos_y = 0 ;
717
+ } else
718
+ handle_release (& dev , & ev );
719
+ }
712
720
}
713
- return 0 ;
714
721
} else if (ev .type == EV_REL ) {
715
722
if (ev .code == REL_Y ) {
716
723
// accumulate the up or down motion reported by
@@ -738,6 +745,7 @@ static int input_callback(int fd, short revents, void *data) {
738
745
dev .slot_current = ev .value ;
739
746
break ;
740
747
case ABS_MT_TRACKING_ID :
748
+ dev .saw_mt_tracking_id = 1 ;
741
749
dev .tracking_id = ev .value ;
742
750
if (dev .tracking_id == -1 && dev .slot_current == 0 )
743
751
handle_release (& dev , & ev );
@@ -784,10 +792,13 @@ static int input_callback(int fd, short revents, void *data) {
784
792
reset_touch (& dev );
785
793
}
786
794
}
787
- break ;
795
+ break ;
788
796
default :
789
797
break ;
790
798
}
799
+ } else if (ev .type == EV_KEY ) {
800
+ if (dev .saw_mt_report && dev .saw_mt_tracking_id && ev .code == BTN_TOUCH && ev .value == 0 )
801
+ handle_release (& dev , & ev );
791
802
} else {
792
803
rel_sum = 0 ;
793
804
}
0 commit comments