lv_btnm: fix sending events for hidden buttons

This commit is contained in:
Gabor Kiss-Vamosi
2020-06-14 21:07:42 +02:00
parent 8532bf80df
commit 9260f9e0aa
2 changed files with 11 additions and 9 deletions

View File

@@ -18,6 +18,7 @@
- add assert if `_lv_mem_buf_get()` fails
- `lv_textarea`: fix character delete in password mode
- Update `LV_OPA_MIN` and `LV_OPA_MAX` to widen the opacity processed range
- `lv_btnm` fix sending events for hidden buttons
## v7.0.1 (01.06.2020)

View File

@@ -821,11 +821,11 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
}
#endif
if(ext->btn_id_act != LV_BTNMATRIX_BTN_NONE) {
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_act]) == false &&
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
uint32_t b = ext->btn_id_act;
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_pr]) == false &&
button_is_inactive(ext->ctrl_bits[ext->btn_id_pr]) == false &&
button_is_hidden(ext->ctrl_bits[ext->btn_id_pr]) == false) {
uint32_t b = ext->btn_id_pr;
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
}
}
@@ -844,21 +844,22 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
invalidate_button_area(btnm, ext->btn_id_pr);
}
ext->btn_id_pr = btn_pr;
ext->btn_id_act = btn_pr;
lv_indev_reset_long_press(param); /*Start the log press time again on the new button*/
if(btn_pr != LV_BTNMATRIX_BTN_NONE &&
button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
/* Send VALUE_CHANGED for the newly pressed button */
uint32_t b = ext->btn_id_act;
uint32_t b = btn_pr;
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
if(res == LV_RES_OK) {
invalidate_button_area(btnm, btn_pr);
}
}
}
ext->btn_id_pr = btn_pr;
ext->btn_id_act = btn_pr;
}
else if(sign == LV_SIGNAL_RELEASED) {
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {