diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2011-06-15 15:45:12 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2011-06-15 15:45:12 +0200 |
commit | 99bd0bc76a1283fa3d9b477f405cad02cd7d9560 (patch) | |
tree | 6d3edda27b573e691fe3a29cabfd0fb640d3dfc3 /powerdebug.c | |
parent | d96731aecee0e3db250215640de26827fcd72505 (diff) | |
download | powerdebug-99bd0bc76a1283fa3d9b477f405cad02cd7d9560.tar.gz |
Encapsulate the display (3)
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'powerdebug.c')
-rw-r--r-- | powerdebug.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/powerdebug.c b/powerdebug.c index e702011..f73aafe 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -154,7 +154,7 @@ int getoptions(int argc, char *argv[], struct powerdebug_options *options) } int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, - char *clkname_str, bool *refreshwin, bool *cont, + char *clkname_str, bool *refreshwin, struct powerdebug_options *options) { char keychar; @@ -170,15 +170,11 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) options->selectedwindow = display_prev_panel(); - if (keystroke == KEY_DOWN) { + if (keystroke == KEY_DOWN) display_next_line(); - *cont = true; - } - if (keystroke == KEY_UP) { + if (keystroke == KEY_UP) display_prev_line(); - *cont = true; - } if (options->selectedwindow == CLOCK) { @@ -243,7 +239,6 @@ int mainloop(struct powerdebug_options *options) bool findparent_ncurses = false; bool refreshwin = false; bool enter_hit = false; - bool cont = false; char clkname_str[64]; strcpy(clkname_str, ""); @@ -260,20 +255,11 @@ int mainloop(struct powerdebug_options *options) sensor_display(); if (options->selectedwindow == CLOCK) { + if (enter_hit) + clock_toggle_expanded(); - if (!cont) { - - if (!findparent_ncurses) { - - if (enter_hit) - clock_toggle_expanded(); - - clock_display(); - enter_hit = false; - } else - find_parents_for_clock(clkname_str, - enter_hit); - } else cont = false; + clock_display(); + enter_hit = false; } FD_ZERO(&readfds); @@ -293,7 +279,7 @@ int mainloop(struct powerdebug_options *options) } if (keystroke_callback(&enter_hit, &findparent_ncurses, - clkname_str, &refreshwin, &cont, options)) + clkname_str, &refreshwin, options)) break; } |