From f33a03c1e5f06091b5d192efc86f000fdac3d5b3 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 20 Dec 2006 22:25:54 +0000 Subject: [PATCH] Use getkey() and symbolic key names. --- src/hci/tui/settings_ui.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c index 706fc021..7be6f91c 100644 --- a/src/hci/tui/settings_ui.c +++ b/src/hci/tui/settings_ui.c @@ -23,6 +23,7 @@ #include #include #include +#include #include /** @file @@ -345,18 +346,19 @@ static int main_loop ( struct config_context *context ) { draw_setting ( &widget ); color_set ( CPAIR_NORMAL, NULL ); - key = getchar(); + key = getkey(); if ( widget.editing ) { key = edit_setting ( &widget, key ); switch ( key ) { - case 0x0a: /* Enter */ + case CR: + case LF: if ( ( rc = save_setting ( &widget ) ) != 0 ) { alert ( " Could not set %s: %s ", widget.setting->name, strerror ( rc ) ); } /* Fall through */ - case 0x03: /* Ctrl-C */ + case CTRL_C: load_setting ( &widget ); break; default: @@ -366,15 +368,15 @@ static int main_loop ( struct config_context *context ) { } else { next = current; switch ( key ) { - case '+': + case KEY_DOWN: if ( next < ( NUM_SETTINGS - 1 ) ) next++; break; - case '-': + case KEY_UP: if ( next > 0 ) next--; break; - case 0x13: /* Ctrl-S */ + case CTRL_S: if ( ( rc = nvo_save ( ugly_nvo_hack ) ) != 0){ alert ( " Could not save options: %s ", strerror ( rc ) );