void touch_commit_events(struct timeval ev_time) { pthread_mutex_lock(&touch_mutex); int has_handlers = (mt_handlers != NULL); pthread_mutex_unlock(&touch_mutex); if(!has_handlers) return; uint32_t i; int res; touch_handler *h; handler_list_it *it; for(i = 0; i < ARRAY_SIZE(mt_events); ++i) { mt_events[i].us_diff = timeval_us_diff(ev_time, mt_events[i].time); mt_events[i].time = ev_time; if(!mt_events[i].changed) continue; keyaction_clear_active(); if(mt_events[i].changed & TCHNG_POS) mt_recalc_pos_rotation(&mt_events[i]); pthread_mutex_lock(&touch_mutex); it = mt_handlers; while(it) { h = it->handler; res = (*h->callback)(&mt_events[i], h->data); if(res == 0) mt_events[i].consumed = 1; else if(res == 1) break; it = it->next; } pthread_mutex_unlock(&touch_mutex); mt_events[i].consumed = 0; mt_events[i].changed = 0; } }
void touch_commit_events(struct timeval ev_time) { pthread_mutex_lock(&touch_mutex); int has_handlers = (mt_handlers != NULL); pthread_mutex_unlock(&touch_mutex); if(!has_handlers) return; uint32_t i; touch_handler *h; handler_list_it *it; for(i = 0; i < ARRAY_SIZE(mt_events); ++i) { mt_events[i].us_diff = get_us_diff(ev_time, mt_events[i].time); mt_events[i].time = ev_time; if(!mt_events[i].changed) continue; if(mt_events[i].changed & TCHNG_POS) mt_recalc_pos_rotation(&mt_events[i]); it = mt_handlers; while(it) { h = it->handler; if((*h->callback)(&mt_events[i], h->data) == 0 && mt_handlers_mode == HANDLERS_FIRST) break; it = it->next; } mt_events[i].changed = 0; } }