diff --git a/src/calc.c b/src/calc.c index e6ebe61..0f8fe5a 100644 --- a/src/calc.c +++ b/src/calc.c @@ -78,12 +78,25 @@ static void adjustFont() fonts_get_system_font(fonts[f])); } +static void custom_unload(Window *window) +{ + text_layer_destroy(s_heading_text_layer); + + window_destroy(window); + s_custom_window = NULL; +} + /** * In normal token list, backspace if possible, otherwise return to script list * In function token list, return to normal token list */ static void click_backspace(ClickRecognizerRef recognizer, void *context) { + if(s_custom_window) { + window_stack_remove(s_custom_window, true); + return; + } + if(!using_func_tokens) { if(mytext[0] == '\0') { window_stack_remove(window_stack_get_top_window(), true); @@ -298,14 +311,6 @@ static void custom_load(Window *window) window_stack_push(s_custom_window, true); } -static void custom_unload(Window *window) -{ - text_layer_destroy(s_heading_text_layer); - - window_destroy(window); - s_custom_window = NULL; -} - Object add_window(Object obj1, Object obj2, struct Environment *env) { printf("ADD_WINDOW\n");