From patchwork Mon Jun 20 22:58:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2098 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 753BE23E52 for ; Mon, 20 Jun 2011 22:58:58 +0000 (UTC) Received: from mail-vw0-f52.google.com (mail-vw0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id 45F61A182CD for ; Mon, 20 Jun 2011 22:58:58 +0000 (UTC) Received: by mail-vw0-f52.google.com with SMTP id 16so4124077vws.11 for ; Mon, 20 Jun 2011 15:58:58 -0700 (PDT) Received: by 10.52.168.65 with SMTP id zu1mr3860140vdb.207.1308610738056; Mon, 20 Jun 2011 15:58:58 -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 em2cs32812vdc; Mon, 20 Jun 2011 15:58:57 -0700 (PDT) Received: by 10.227.32.76 with SMTP id b12mr5546324wbd.45.1308610735258; Mon, 20 Jun 2011 15:58:55 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp03.smtpout.orange.fr [80.12.242.125]) by mx.google.com with ESMTP id ff9si10277998wbb.48.2011.06.20.15.58.54; Mon, 20 Jun 2011 15:58:55 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.125 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.125; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.125 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.95.191]) by mwinf5d06 with ME id yNyp1g00347kPVY03NyuDB; Tue, 21 Jun 2011 00:58:54 +0200 From: Daniel Lezcano To: linaro-dev@lists.linaro.org Subject: [powerdebug 10/17] Optimize the display Date: Tue, 21 Jun 2011 00:58:18 +0200 Message-Id: <1308610705-23281-10-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308610705-23281-1-git-send-email-daniel.lezcano@linaro.org> References: <1308610705-23281-1-git-send-email-daniel.lezcano@linaro.org> Signed-off-by: Daniel Lezcano --- clocks.c | 2 +- display.c | 14 ++++---------- display.h | 2 +- regulator.c | 2 +- sensor.c | 2 +- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/clocks.c b/clocks.c index 93dd4b3..59db8a7 100644 --- a/clocks.c +++ b/clocks.c @@ -295,7 +295,7 @@ static int clock_print_header(void) "Name", "Flags", "Rate", "Usecount", "Children") < 0) return -1; - ret = display_header_footer(CLOCK, buf); + ret = display_column_name(buf); free(buf); diff --git a/display.c b/display.c index 43f3797..be78ce0 100644 --- a/display.c +++ b/display.c @@ -293,12 +293,12 @@ static int display_keystroke(int fd, void *data) case KEY_RIGHT: case '\t': - display_next_panel(); + display_show_header(display_next_panel()); break; case KEY_LEFT: case KEY_BTAB: - display_prev_panel(); + display_show_header(display_prev_panel()); break; case KEY_DOWN: @@ -429,21 +429,15 @@ int display_init(int wdefault) return display_refresh(wdefault); } -int display_header_footer(int win, const char *line) +int display_column_name(const char *line) { - int ret; - werase(main_win); wattron(main_win, A_BOLD); mvwprintw(main_win, 0, 0, "%s", line); wattroff(main_win, A_BOLD); wrefresh(main_win); - ret = display_show_header(win); - if (ret) - return ret; - - return display_show_footer(win); + return 0; } int display_register(int win, struct display_ops *ops) diff --git a/display.h b/display.h index 8586f5e..f9a762c 100644 --- a/display.h +++ b/display.h @@ -29,5 +29,5 @@ extern void *display_get_row_data(int window); extern int display_init(int wdefault); extern int display_register(int win, struct display_ops *ops); -extern int display_header_footer(int win, const char *line); extern int display_refresh(int win); +extern int display_column_name(const char *line); diff --git a/regulator.c b/regulator.c index c8cbe2d..97ab15b 100644 --- a/regulator.c +++ b/regulator.c @@ -148,7 +148,7 @@ static int regulator_print_header(void) "Min u-volts", "Max u-volts") < 0) return -1; - ret = display_header_footer(REGULATOR, buf); + ret = display_column_name(buf); free(buf); diff --git a/sensor.c b/sensor.c index 399605b..2a8f4bb 100644 --- a/sensor.c +++ b/sensor.c @@ -243,7 +243,7 @@ static int sensor_print_header(void) if (asprintf(&buf, "%-36s%s", "Name", "Value") < 0) return -1; - ret = display_header_footer(SENSOR, buf); + ret = display_column_name(buf); free(buf);