From patchwork Wed Jun 15 13:50:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1932 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7FAFA24B33 for ; Wed, 15 Jun 2011 13:52:43 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4F3A7A18972 for ; Wed, 15 Jun 2011 13:52:43 +0000 (UTC) Received: by mail-vx0-f180.google.com with SMTP id 12so410110vxk.11 for ; Wed, 15 Jun 2011 06:52:43 -0700 (PDT) Received: by 10.52.75.4 with SMTP id y4mr790552vdv.167.1308145963046; Wed, 15 Jun 2011 06:52:43 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs126636vdc; Wed, 15 Jun 2011 06:52:42 -0700 (PDT) Received: by 10.216.143.74 with SMTP id k52mr634739wej.0.1308145961082; Wed, 15 Jun 2011 06:52:41 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp05.smtpout.orange.fr [80.12.242.127]) by mx.google.com with ESMTP id y61si1386330weq.84.2011.06.15.06.52.40; Wed, 15 Jun 2011 06:52:41 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.127 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.127; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.127 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([92.134.76.78]) by mwinf5d28 with ME id wDsa1g00D1hMfSL03DsgCo; Wed, 15 Jun 2011 15:52:40 +0200 From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: linaro-dev@lists.linaro.org, patches@linaro.org Subject: [powerdebug 10/22] Encapsulate the display (3) Date: Wed, 15 Jun 2011 15:50:44 +0200 Message-Id: <1308145856-6112-10-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308145856-6112-1-git-send-email-daniel.lezcano@linaro.org> References: <1308145856-6112-1-git-send-email-daniel.lezcano@linaro.org> Signed-off-by: Daniel Lezcano --- 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; }