Signed-off-by: Daniel Lezcano <daniel.lezc...@linaro.org> --- powerdebug.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index dd4fe91..5fe07de 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -15,6 +15,7 @@ #include <getopt.h> #include <stdbool.h> +#include <math.h> #include "regulator.h" #include "display.h" #include "clocks.h" @@ -164,17 +165,16 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, if (keystroke == EOF) exit(0); - if (keystroke == KEY_RIGHT || keystroke == '\t') + if (keystroke == KEY_RIGHT || keystroke == '\t') { options->selectedwindow++; + options->selectedwindow %= TOTAL_FEATURE_WINS; + } - if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) + if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) { options->selectedwindow--; - - if (options->selectedwindow >= TOTAL_FEATURE_WINS) - options->selectedwindow = 0; - - if (options->selectedwindow < 0) - options->selectedwindow = TOTAL_FEATURE_WINS - 1; + if (options->selectedwindow < 0) + options->selectedwindow = TOTAL_FEATURE_WINS - 1; + } if (options->selectedwindow == CLOCK) { if (keystroke == KEY_DOWN) -- 1.7.1 _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev