From b1142ac7b103283c5d2d4fc33f9d5ba8633ad1c2 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 26 Jun 2023 09:46:30 +0200 Subject: [PATCH] fix(btnmatrix): ignore pressing while scrolling related to #4301 --- src/widgets/btnmatrix/lv_btnmatrix.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/btnmatrix/lv_btnmatrix.c b/src/widgets/btnmatrix/lv_btnmatrix.c index 1df2281f1..d17dcc89c 100644 --- a/src/widgets/btnmatrix/lv_btnmatrix.c +++ b/src/widgets/btnmatrix/lv_btnmatrix.c @@ -444,10 +444,19 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e) } } else if(code == LV_EVENT_PRESSING) { + lv_indev_t * indev = lv_indev_get_act(); + /*Ignore while scrolling*/ + if(lv_indev_get_scroll_obj(indev)) { + if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { + invalidate_button_area(obj, btnm->btn_id_sel); + btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; + invalidate_button_area(obj, btnm->btn_id_sel); + } + return; + } void * param = lv_event_get_param(e); uint16_t btn_pr = LV_BTNMATRIX_BTN_NONE; /*Search the pressed area*/ - lv_indev_t * indev = lv_indev_get_act(); lv_indev_type_t indev_type = lv_indev_get_type(indev); if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) return;