From 56034f9aacbde11c57807eee16e87ca03e560abc Mon Sep 17 00:00:00 2001 From: CTCaer Date: Thu, 30 Apr 2020 04:32:55 +0300 Subject: [PATCH] nyx: Ensure that close button var always gets nulled --- nyx/nyx_gui/frontend/gui.c | 9 ++++++++- nyx/nyx_gui/frontend/gui_emummc_tools.c | 2 ++ nyx/nyx_gui/frontend/gui_options.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index d9babca..0a6d75c 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -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) { 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_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; } diff --git a/nyx/nyx_gui/frontend/gui_emummc_tools.c b/nyx/nyx_gui/frontend/gui_emummc_tools.c index 448482a..465374e 100644 --- a/nyx/nyx_gui/frontend/gui_emummc_tools.c +++ b/nyx/nyx_gui/frontend/gui_emummc_tools.c @@ -51,6 +51,8 @@ static lv_res_t _action_emummc_window_close(lv_obj_t *btn) (*emummc_tools)(NULL); + close_btn = NULL; + return LV_RES_INV; } diff --git a/nyx/nyx_gui/frontend/gui_options.c b/nyx/nyx_gui/frontend/gui_options.c index dfe9697..9c7eb36 100644 --- a/nyx/nyx_gui/frontend/gui_options.c +++ b/nyx/nyx_gui/frontend/gui_options.c @@ -71,6 +71,8 @@ static lv_res_t _win_autoboot_close_action(lv_obj_t * btn) lv_obj_del(win); + close_btn = NULL; + return LV_RES_INV; }