Fix shutdown message box not closing on decline

This commit is contained in:
Johannes Marbach 2024-03-30 21:27:37 +01:00
parent 5320429fcb
commit b226eb1816
2 changed files with 13 additions and 2 deletions

View file

@ -296,8 +296,18 @@ static void shutdown_mbox_confirmed_cb(lv_event_t *event) {
}
static void shutdown_mbox_declined_cb(lv_event_t *event) {
lv_obj_t *mbox = lv_event_get_target(event);
lv_msgbox_close(mbox);
// Find the containing message box for the clicked button
lv_obj_t *obj = lv_event_get_target(event);
while (obj && !lv_obj_check_type(obj, &lv_msgbox_class)) {
obj = lv_obj_get_parent(obj);
}
if (!obj) {
bbx_log(BBX_LOG_LEVEL_ERROR, "Could not find containing message box for clicked button");
return;
}
lv_msgbox_close(obj);
}
static void keyboard_value_changed_cb(lv_event_t *event) {