User-created windows close with back button

This commit is contained in:
= 2020-08-03 14:17:49 +01:00
parent ab095694d0
commit f318eb6b49
1 changed files with 13 additions and 8 deletions

View File

@ -78,12 +78,25 @@ static void adjustFont()
fonts_get_system_font(fonts[f])); 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 normal token list, backspace if possible, otherwise return to script list
* In function token list, return to normal token list * In function token list, return to normal token list
*/ */
static void click_backspace(ClickRecognizerRef recognizer, void *context) 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(!using_func_tokens) {
if(mytext[0] == '\0') { if(mytext[0] == '\0') {
window_stack_remove(window_stack_get_top_window(), true); 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); 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) Object add_window(Object obj1, Object obj2, struct Environment *env)
{ {
printf("ADD_WINDOW\n"); printf("ADD_WINDOW\n");