From 3ab17fc90cd1d6dee1e6e3f6a695ad14766f57dc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 14 Apr 2026 09:40:27 +0300 Subject: fix: move history-edit delete from long-BACK to long-DOWN Pebble OS intercepts BACK at the firmware level before long-click handlers can fire, making window_long_click_subscribe(BUTTON_ID_BACK) unreliable. Move the 700 ms delete gesture to DOWN, which has no OS-level conflict. Update hint text accordingly. Co-Authored-By: Claude Sonnet 4.6 --- src/c/fastforge.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/c/fastforge.c b/src/c/fastforge.c index 9435166..d83d263 100644 --- a/src/c/fastforge.c +++ b/src/c/fastforge.c @@ -109,7 +109,7 @@ static char s_history_edit_start_text[32]; static char s_history_edit_end_text[32]; static char s_history_edit_duration_text[48]; static char s_history_edit_stage_text[24]; -/* 45 bytes needed: "UP/DN adj SEL field\nHOLD save BACK-hold del" + NUL */ +/* 44 bytes needed: "UP/DN adj SEL field\nHOLD save DN-hold del" + NUL */ static char s_history_edit_hint_text[48]; static char s_running_edit_start_text[32]; static char s_running_edit_elapsed_text[32]; @@ -843,7 +843,7 @@ static void refresh_history_edit_window_content(void) { s_history_edit_field == EDIT_FIELD_NOTE ? '>' : ' ', note_text); snprintf(s_history_edit_stage_text, sizeof(s_history_edit_stage_text), "Badge %s", badge_label ? badge_label : "--"); - snprintf(s_history_edit_hint_text, sizeof(s_history_edit_hint_text), "UP/DN adj SEL field\nHOLD save BACK-hold del"); + snprintf(s_history_edit_hint_text, sizeof(s_history_edit_hint_text), "UP/DN adj SEL field\nHOLD save DN-hold del"); text_layer_set_text(s_history_edit_title_layer, s_history_edit_title_text); text_layer_set_text(s_history_edit_start_layer, s_history_edit_start_text); @@ -965,10 +965,12 @@ static void history_edit_save_click_handler(ClickRecognizerRef recognizer, void static void history_edit_back_click_handler(ClickRecognizerRef recognizer, void *context) { (void)recognizer; (void)context; + /* Explicit handler prevents the system from popping on press, allowing the + * 700 ms long-click delete handler below to receive the button event. */ window_stack_remove(s_history_edit_window, true); } -/* Long-press BACK deletes the current entry and returns to the history list. */ +/* Long-press BACK (700 ms) deletes the entry; plain BACK discards edits. */ static void history_edit_delete_click_handler(ClickRecognizerRef recognizer, void *context) { (void)recognizer; (void)context; @@ -988,7 +990,9 @@ static void history_edit_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, history_edit_select_click_handler); window_single_click_subscribe(BUTTON_ID_BACK, history_edit_back_click_handler); window_long_click_subscribe(BUTTON_ID_SELECT, 500, history_edit_save_click_handler, NULL); - window_long_click_subscribe(BUTTON_ID_BACK, 700, history_edit_delete_click_handler, NULL); + /* Long-press BACK does NOT work in Pebble SDK — the OS intercepts BACK before + * the long-click threshold fires. Use long-press DOWN for delete instead. */ + window_long_click_subscribe(BUTTON_ID_DOWN, 700, history_edit_delete_click_handler, NULL); } static void running_fast_edit_apply_delta_minutes(int delta_minutes) { -- cgit v1.2.3