fix(buttonmatrix): add check for indev POINTER | BUTTON type (#7125)

Co-authored-by: David Ramunno <david.ramunno@swoboda.com>
This commit is contained in:
RamDav
2024-11-07 10:04:44 +01:00
committed by GitHub
parent 17d0169e50
commit 50e9f48fff
+4 -1
View File
@@ -456,9 +456,11 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e
} }
} }
else if(code == LV_EVENT_PRESSING) { else if(code == LV_EVENT_PRESSING) {
/*If a slid to a new button, discard the current button and don't press any buttons*/
if(btnm->btn_id_sel != LV_BUTTONMATRIX_BUTTON_NONE) { if(btnm->btn_id_sel != LV_BUTTONMATRIX_BUTTON_NONE) {
lv_indev_t * indev = lv_event_get_indev(e); lv_indev_t * indev = lv_event_get_indev(e);
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_POINTER || indev_type == LV_INDEV_TYPE_BUTTON) {
/*If pointer device slid to a new button, discard the current button and don't press any buttons*/
lv_indev_get_point(indev, &p); lv_indev_get_point(indev, &p);
uint32_t btn_pr = get_button_from_point(obj, &p); uint32_t btn_pr = get_button_from_point(obj, &p);
if(btn_pr != btnm->btn_id_sel) { if(btn_pr != btnm->btn_id_sel) {
@@ -467,6 +469,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e
} }
} }
} }
}
else if(code == LV_EVENT_RELEASED) { else if(code == LV_EVENT_RELEASED) {
if(btnm->btn_id_sel != LV_BUTTONMATRIX_BUTTON_NONE) { if(btnm->btn_id_sel != LV_BUTTONMATRIX_BUTTON_NONE) {
/*Toggle the button if enabled*/ /*Toggle the button if enabled*/