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

update lv_indev_enable to enable/disable an indev not a type

This commit is contained in:
Gabor Kiss-Vamosi 2019-03-13 22:08:20 +01:00
parent 89d56e5723
commit b8f598112f
3 changed files with 13 additions and 17 deletions

View File

@ -111,7 +111,7 @@ void lv_indev_reset(lv_indev_t * indev)
* Reset the long press state of an input device
* @param indev pointer to an input device
*/
void lv_indev_reset_lpr(lv_indev_t * indev)
void lv_indev_reset_long_press(lv_indev_t * indev)
{
indev->proc.long_pr_sent = 0;
indev->proc.longpr_rep_timestamp = lv_tick_get();
@ -119,19 +119,15 @@ void lv_indev_reset_lpr(lv_indev_t * indev)
}
/**
* Enable input devices device by type
* @param type Input device type
* @param enable true: enable this type; false: disable this type
* Enable or disable an input devices
* @param indev pointer to an input device
* @param en true: enable; false: disable
*/
void lv_indev_enable(lv_hal_indev_type_t type, bool enable)
void lv_indev_enable(lv_indev_t * indev, bool en)
{
if(!indev) return;
lv_indev_t * i = lv_indev_next(NULL);
while(i) {
if(i->driver.type == type) i->proc.disabled = enable == false ? 1 : 0;
i = lv_indev_next(i);
}
indev->proc.disabled = en ? 1 : 0;
}
/**

View File

@ -58,14 +58,14 @@ void lv_indev_reset(lv_indev_t * indev);
* Reset the long press state of an input device
* @param indev_proc pointer to an input device
*/
void lv_indev_reset_lpr(lv_indev_t * indev);
void lv_indev_reset_long_press(lv_indev_t * indev);
/**
* Enable input devices device by type
* @param type Input device type
* @param enable true: enable this type; false: disable this type
* Enable or disable an input devices
* @param indev pointer to an input device
* @param en true: enable; false: disable
*/
void lv_indev_enable(lv_hal_indev_type_t type, bool enable);
void lv_indev_enable(lv_indev_t * indev, bool en);
/**
* Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)

View File

@ -841,7 +841,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
btn_pr = get_button_from_point(btnm, &p);
/*Invalidate to old and the new areas*/;
if(btn_pr != ext->btn_id_pr) {
lv_indev_reset_lpr(param);
lv_indev_reset_long_press(param);
if(ext->btn_id_pr != LV_BTNM_BTN_NONE) {
invalidate_button_area(btnm, ext->btn_id_pr);
}