diff --git a/term_util.c b/term_util.c index 844086b..35851ce 100644 --- a/term_util.c +++ b/term_util.c @@ -66,7 +66,6 @@ void term_util_init_colors() { struct Qmsg { Qblock qblock; - Qmsg_dismiss_type dismiss_type; }; struct Qmenu { @@ -207,10 +206,9 @@ void qmsg_set_title(Qmsg* qm, char const* title) { qblock_set_title(&qm->qblock, title); } -Qmsg* qmsg_push(int height, int width, Qmsg_dismiss_type dismiss_type) { +Qmsg* qmsg_push(int height, int width) { Qmsg* qm = malloc(sizeof(Qmsg)); qblock_init(&qm->qblock, Qblock_type_qmsg); - qm->dismiss_type = dismiss_type; qnav_stack_push(&qm->qblock, height, width); return qm; } @@ -224,11 +222,6 @@ bool qmsg_drive(Qmsg* qm, int key) { case KEY_ENTER: return true; } - // TODO do we need some smarter filter here? What kinds of control codes do - // we need to ignore so that we only dismiss on keyboard events? - if (qm->dismiss_type == Qmsg_dismiss_easily) { - return true; - } return false; } diff --git a/term_util.h b/term_util.h index 88934f6..17c917b 100644 --- a/term_util.h +++ b/term_util.h @@ -74,11 +74,6 @@ typedef struct { typedef struct Qmsg Qmsg; -typedef enum { - Qmsg_dismiss_easily, - Qmsg_dismiss_deliberately, -} Qmsg_dismiss_type; - typedef struct Qmenu Qmenu; typedef enum { @@ -121,7 +116,7 @@ void qnav_stack_pop(void); void qblock_print_frame(Qblock* qb, bool active); void qblock_set_title(Qblock* qb, char const* title); -Qmsg* qmsg_push(int height, int width, Qmsg_dismiss_type dismiss_type); +Qmsg* qmsg_push(int height, int width); WINDOW* qmsg_window(Qmsg* qm); void qmsg_set_title(Qmsg* qm, char const* title); bool qmsg_drive(Qmsg* qm, int key); diff --git a/tui_main.c b/tui_main.c index 6173069..1979b7b 100644 --- a/tui_main.c +++ b/tui_main.c @@ -1779,8 +1779,7 @@ void push_about_msg(void) { width += hpad * 2; int logo_left_pad = (width - cols) / 2; int footer_left_pad = (width - footer_len) / 2; - Qmsg* qm = - qmsg_push(tpad + rows + sep + 1 + bpad, width, Qmsg_dismiss_deliberately); + Qmsg* qm = qmsg_push(tpad + rows + sep + 1 + bpad, width); WINDOW* w = qmsg_window(qm); for (int row = 0; row < rows; ++row) { wmove(w, row + tpad, logo_left_pad); @@ -1851,8 +1850,7 @@ void push_controls_msg(void) { } int mid_pad = 2; int total_width = 1 + w_input + mid_pad + w_desc; - Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width, - Qmsg_dismiss_deliberately); + Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width); qmsg_set_title(qm, "Controls"); WINDOW* w = qmsg_window(qm); for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) { @@ -1867,7 +1865,7 @@ void push_controls_msg(void) { } } -void push_opers_guide_msg(Qmsg_dismiss_type dismiss_type) { +void push_opers_guide_msg(void) { struct Guide_item { char glyph; char const* name; @@ -1921,7 +1919,7 @@ void push_opers_guide_msg(Qmsg_dismiss_type dismiss_type) { int left_pad = 1; int mid_pad = 1; int total_width = left_pad + 1 + mid_pad + w_desc; - Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width, dismiss_type); + Qmsg* qm = qmsg_push(ORCA_ARRAY_COUNTOF(items), total_width); qmsg_set_title(qm, "Operators"); WINDOW* w = qmsg_window(qm); for (int i = 0; i < (int)ORCA_ARRAY_COUNTOF(items); ++i) { @@ -1938,7 +1936,7 @@ void try_save_with_msg(Ged* ged) { if (!ged->filename) return; bool ok = hacky_try_save(&ged->field, ged->filename); - Qmsg* msg = qmsg_push(3, 50, Qmsg_dismiss_deliberately); + Qmsg* msg = qmsg_push(3, 50); WINDOW* msgw = qmsg_window(msg); wmove(msgw, 0, 1); if (ok) { @@ -2256,8 +2254,6 @@ int main(int argc, char** argv) { // Send initial BPM send_num_message(ged_state.oosc_dev, "/orca/bpm", (I32)ged_state.bpm); - push_opers_guide_msg(Qmsg_dismiss_easily); // I don't know about this - for (;;) { switch (key) { case ERR: { @@ -2430,7 +2426,7 @@ int main(int argc, char** argv) { push_controls_msg(); break; case Main_menu_opers_guide: - push_opers_guide_msg(Qmsg_dismiss_deliberately); + push_opers_guide_msg(); break; case Main_menu_about: push_about_msg(); @@ -2642,7 +2638,7 @@ int main(int argc, char** argv) { push_controls_msg(); break; case CTRL_PLUS('g'): - push_opers_guide_msg(Qmsg_dismiss_deliberately); + push_opers_guide_msg(); break; case CTRL_PLUS('s'): try_save_with_msg(&ged_state);