aboutsummaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2017-09-03 16:30:39 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-09-03 16:37:35 +0200
commit53f0f1d2e375ed800fe9235d359a119f0eee592e (patch)
tree024fb7cdb29e35df2c9d9c75a6f981d1d7dbba87 /src/io.c
parent8373ecfe5137a42035ce472eb47e84391b10a2c4 (diff)
downloadcalcurse-53f0f1d2e375ed800fe9235d359a119f0eee592e.tar.gz
calcurse-53f0f1d2e375ed800fe9235d359a119f0eee592e.zip
Add a function to wait for any key press
Introduce a new function keys_wait_for_any_key() and use it instead of wgetch() whenever the return value is discarded. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/io.c b/src/io.c
index 6f87407..ac3836e 100644
--- a/src/io.c
+++ b/src/io.c
@@ -182,7 +182,7 @@ static FILE *get_export_stream(enum export_type type)
stream = fopen(stream_name, "w");
if (stream == NULL) {
status_mesg(wrong_name, press_enter);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
}
}
@@ -470,7 +470,7 @@ void io_save_cal(enum save_display display)
if (ui_mode == UI_CURSES && display == IO_SAVE_DISPLAY_BAR &&
show_dialogs()) {
status_mesg(save_success, enter);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
}
pthread_mutex_unlock(&io_save_mutex);
@@ -873,7 +873,7 @@ void io_reload_data(void)
if (show_dialogs()) {
status_mesg(reload_success, enter);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
}
if (notify_bar())
@@ -1157,7 +1157,7 @@ void io_startup_screen(int no_data_file)
status_mesg(_("Data files found. Data will be loaded now."),
enter);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
}
/* Export calcurse data. */
@@ -1192,7 +1192,7 @@ void io_export_data(enum export_type type, int export_uid)
if (show_dialogs() && ui_mode == UI_CURSES) {
status_mesg(success, enter);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
}
}
@@ -1217,7 +1217,7 @@ static FILE *get_import_stream(enum import_type type)
stream = fopen(stream_name, "r");
if (stream == NULL) {
status_mesg(wrong_file, press_enter);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
}
}
mem_free(stream_name);
@@ -1305,7 +1305,7 @@ void io_import_data(enum import_type type, const char *stream_name,
status_mesg(read, stat);
mem_free(read);
mem_free(stat);
- wgetch(win[KEY].p);
+ keys_wait_for_any_key(win[KEY].p);
} else if (ui_mode == UI_CMDLINE && show_dialogs()) {
printf(proc_report, stats.lines);
printf("\n%s / %s / %s / %s\n", stats_str[0], stats_str[1],