1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

Merge pull request #105 from upbeat27/indev-proc-fix

Fix input device processing
This commit is contained in:
Gabor Kiss-Vamosi 2018-02-07 13:07:39 +01:00 committed by GitHub
commit 7e17d38754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@
#if LV_INDEV_READ_PERIOD != 0 #if LV_INDEV_READ_PERIOD != 0
static void indev_proc_task(void * param); static void indev_proc_task(void * param);
static void indev_proc_reset_query_handler(lv_indev_t * indev);
static void indev_proc_point(lv_indev_proc_t * indev); static void indev_proc_point(lv_indev_proc_t * indev);
static void indev_proc_press(lv_indev_proc_t * info); static void indev_proc_press(lv_indev_proc_t * info);
static void indev_proc_release(lv_indev_proc_t * state); static void indev_proc_release(lv_indev_proc_t * state);
@ -226,22 +227,13 @@ static void indev_proc_task(void * param)
indev_act = i; indev_act = i;
/*Handle reset query before processing the point*/ /*Handle reset query before processing the point*/
if(i->proc.reset_query) { indev_proc_reset_query_handler(i);
i->proc.act_obj = NULL;
i->proc.last_obj = NULL;
i->proc.drag_range_out = 0;
i->proc.drag_in_prog = 0;
i->proc.long_pr_sent = 0;
i->proc.pr_timestamp = 0;
i->proc.longpr_rep_timestamp = 0;
i->proc.drag_sum.x = 0;
i->proc.drag_sum.y = 0;
i->proc.reset_query = 0;
}
if(i->proc.disabled == 0) { if(i->proc.disabled == 0) {
bool more_to_read;
do{
/*Read the data*/ /*Read the data*/
lv_indev_read(i, &data); more_to_read = lv_indev_read(i, &data);
i->proc.state = data.state; i->proc.state = data.state;
if(i->proc.state == LV_INDEV_STATE_PR) { if(i->proc.state == LV_INDEV_STATE_PR) {
@ -283,20 +275,9 @@ static void indev_proc_task(void * param)
i->proc.last_state = data.state; i->proc.last_state = data.state;
#endif #endif
} }
}
/*Handle reset query if it happened in during processing*/ /*Handle reset query if it happened in during processing*/
if(i->proc.reset_query) { indev_proc_reset_query_handler(i);
i->proc.act_obj = NULL; } while(more_to_read);
i->proc.last_obj = NULL;
i->proc.drag_range_out = 0;
i->proc.drag_in_prog = 0;
i->proc.long_pr_sent = 0;
i->proc.pr_timestamp = 0;
i->proc.longpr_rep_timestamp = 0;
i->proc.drag_sum.x = 0;
i->proc.drag_sum.y = 0;
i->proc.reset_query = 0;
} }
i = lv_indev_next(i); /*Go to the next indev*/ i = lv_indev_next(i); /*Go to the next indev*/
@ -305,6 +286,26 @@ static void indev_proc_task(void * param)
indev_act = NULL; /*End of indev processing, so no act indev*/ indev_act = NULL; /*End of indev processing, so no act indev*/
} }
/**
* Reset input device if a reset query has been sent to it
* @param indev pointer to an input device
*/
static void indev_proc_reset_query_handler(lv_indev_t * indev)
{
if(indev->proc.reset_query) {
indev->proc.act_obj = NULL;
indev->proc.last_obj = NULL;
indev->proc.drag_range_out = 0;
indev->proc.drag_in_prog = 0;
indev->proc.long_pr_sent = 0;
indev->proc.pr_timestamp = 0;
indev->proc.longpr_rep_timestamp = 0;
indev->proc.drag_sum.x = 0;
indev->proc.drag_sum.y = 0;
indev->proc.reset_query = 0;
}
}
/** /**
* Process new points from a input device. indev->state.pressed has to be set * Process new points from a input device. indev->state.pressed has to be set
* @param indev pointer to an input device state * @param indev pointer to an input device state