nyx: Ensure that close button var always gets nulled

This commit is contained in:
CTCaer 2020-04-30 04:32:55 +03:00
parent 7e96a4dd3a
commit 56034f9aac
3 changed files with 12 additions and 1 deletions

View file

@ -455,6 +455,13 @@ void nyx_window_toggle_buttons(lv_obj_t *win, bool disable)
} }
} }
lv_res_t lv_win_close_action_custom(lv_obj_t * btn)
{
close_btn = NULL;
return lv_win_close_action(btn);
}
lv_obj_t *nyx_create_standard_window(const char *win_title) lv_obj_t *nyx_create_standard_window(const char *win_title)
{ {
static lv_style_t win_bg_style; static lv_style_t win_bg_style;
@ -468,7 +475,7 @@ lv_obj_t *nyx_create_standard_window(const char *win_title)
lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style); lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style);
lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES); lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES);
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", lv_win_close_action); close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", lv_win_close_action_custom);
return win; return win;
} }

View file

@ -51,6 +51,8 @@ static lv_res_t _action_emummc_window_close(lv_obj_t *btn)
(*emummc_tools)(NULL); (*emummc_tools)(NULL);
close_btn = NULL;
return LV_RES_INV; return LV_RES_INV;
} }

View file

@ -71,6 +71,8 @@ static lv_res_t _win_autoboot_close_action(lv_obj_t * btn)
lv_obj_del(win); lv_obj_del(win);
close_btn = NULL;
return LV_RES_INV; return LV_RES_INV;
} }