diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-22 16:18:21 +0900 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-22 16:18:21 +0900 |
commit | 14e0d1887808a3d8233dd14877bce7da2fe8ca12 (patch) | |
tree | a36e09b3009dbd317dfb9c491d056ae2ab209927 | |
parent | 52b3d99b880e7a0031337f86a34094d116c768f0 (diff) |
Handle user input better in the main loop
-rw-r--r-- | src/calculer.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/calculer.c b/src/calculer.c index eab2bde..589724f 100644 --- a/src/calculer.c +++ b/src/calculer.c @@ -200,12 +200,19 @@ main(int argc, char *argv[]) disp->display_calc(x, y); void *measure_data = measure_before(); input = disp->read_input(); - if (input == INT_MAX) + if ((input == DISP_QUIT) || (input == DISP_ERR)) { - disp->destroy(); + destroy_disp(disp); fclose(logfile); exit(0); } +#ifndef NDEBUG + else if (input == DISP_RELOAD) + { + disp_reload(disp); + continue; + } +#endif measure_after(measure_data, input == res); disp->display_res(input == res, 0); } |