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:
commit
7e17d38754
@ -30,6 +30,7 @@
|
||||
|
||||
#if LV_INDEV_READ_PERIOD != 0
|
||||
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_press(lv_indev_proc_t * info);
|
||||
static void indev_proc_release(lv_indev_proc_t * state);
|
||||
@ -226,22 +227,13 @@ static void indev_proc_task(void * param)
|
||||
indev_act = i;
|
||||
|
||||
/*Handle reset query before processing the point*/
|
||||
if(i->proc.reset_query) {
|
||||
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;
|
||||
}
|
||||
indev_proc_reset_query_handler(i);
|
||||
|
||||
if(i->proc.disabled == 0) {
|
||||
bool more_to_read;
|
||||
do{
|
||||
/*Read the data*/
|
||||
lv_indev_read(i, &data);
|
||||
more_to_read = lv_indev_read(i, &data);
|
||||
i->proc.state = data.state;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*Handle reset query if it happened in during processing*/
|
||||
if(i->proc.reset_query) {
|
||||
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;
|
||||
indev_proc_reset_query_handler(i);
|
||||
} while(more_to_read);
|
||||
}
|
||||
|
||||
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*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param indev pointer to an input device state
|
||||
|
Loading…
x
Reference in New Issue
Block a user