[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1424225916-13488-4-git-send-email-computersforpeace@gmail.com>
Date: Tue, 17 Feb 2015 18:18:31 -0800
From: Brian Norris <computersforpeace@...il.com>
To: Zhang Rui <rui.zhang@...el.com>, <jacob.jun.pan@...ux.intel.com>
Cc: Neil Horman <nhorman@...driver.com>,
Brian Norris <computersforpeace@...il.com>,
Javi Merino <javi.merino@....com>,
Florian Fainelli <f.fainelli@...il.com>,
<linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>
Subject: [PATCH 3/8] tools/thermal: tmon: tui: don't hard-code dialog window size assumptions
We can use the ncurses API to get the number of rows.
Signed-off-by: Brian Norris <computersforpeace@...il.com>
---
tools/thermal/tmon/tui.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/thermal/tmon/tui.c b/tools/thermal/tmon/tui.c
index 43c5aecf71da..2779573a53cb 100644
--- a/tools/thermal/tmon/tui.c
+++ b/tools/thermal/tmon/tui.c
@@ -274,11 +274,14 @@ const char DIAG_TITLE[] = "[ TUNABLES ]";
void show_dialogue(void)
{
int j, x = 0, y = 0;
+ int rows, cols;
WINDOW *w = dialogue_window;
if (tui_disabled || !w)
return;
+ getmaxyx(w, rows, cols);
+
werase(w);
box(w, 0, 0);
mvwprintw(w, 0, maxx/4, DIAG_TITLE);
@@ -297,10 +300,8 @@ void show_dialogue(void)
wattron(w, A_BOLD);
mvwprintw(w, DIAG_DEV_ROWS+1, 1, "Enter Choice [A-Z]?");
wattroff(w, A_BOLD);
- /* y size of dialogue win is nr cdev + 5, so print legend
- * at the bottom line
- */
- mvwprintw(w, ptdata.nr_cooling_dev+3, 1,
+ /* print legend at the bottom line */
+ mvwprintw(w, rows - 2, 1,
"Legend: A=Active, P=Passive, C=Critical");
wrefresh(dialogue_window);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists