From: Brian Norris <computersforpeace@gmail.com>
To: Zhang Rui <rui.zhang@intel.com>, jacob.jun.pan@linux.intel.com
Cc: Neil Horman <nhorman@tuxdriver.com>,
Brian Norris <computersforpeace@gmail.com>,
Javi Merino <javi.merino@arm.com>,
Florian Fainelli <f.fainelli@gmail.com>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [PATCH 3/8] tools/thermal: tmon: tui: don't hard-code dialog window size assumptions
Date: Tue, 17 Feb 2015 18:18:31 -0800 [thread overview]
Message-ID: <1424225916-13488-4-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1424225916-13488-1-git-send-email-computersforpeace@gmail.com>
We can use the ncurses API to get the number of rows.
Signed-off-by: Brian Norris <computersforpeace@gmail.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
WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Zhang Rui <rui.zhang@intel.com>, <jacob.jun.pan@linux.intel.com>
Cc: Neil Horman <nhorman@tuxdriver.com>,
Brian Norris <computersforpeace@gmail.com>,
Javi Merino <javi.merino@arm.com>,
Florian Fainelli <f.fainelli@gmail.com>,
<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>
Subject: [PATCH 3/8] tools/thermal: tmon: tui: don't hard-code dialog window size assumptions
Date: Tue, 17 Feb 2015 18:18:31 -0800 [thread overview]
Message-ID: <1424225916-13488-4-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1424225916-13488-1-git-send-email-computersforpeace@gmail.com>
We can use the ncurses API to get the number of rows.
Signed-off-by: Brian Norris <computersforpeace@gmail.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
next prev parent reply other threads:[~2015-02-18 2:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 2:18 [PATCH 0/8] tools/thermal: tmon: UI and build system improvements Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` [PATCH 1/8] tools/thermal: tmon: add --target-temp parameter Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` [PATCH 2/8] tools/thermal: tmon: add min/max macros Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` Brian Norris [this message]
2015-02-18 2:18 ` [PATCH 3/8] tools/thermal: tmon: tui: don't hard-code dialog window size assumptions Brian Norris
2015-02-18 2:18 ` [PATCH 4/8] tools/thermal: tmon: fixup tui windowing calculations Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` [PATCH 5/8] tools/thermal: tmon: add .gitignore Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` [PATCH 6/8] tools/thermal: tmon: support cross-compiling Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` [PATCH 7/8] tools/thermal: tmon: use pkg-config to determine library dependencies Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 2:18 ` [PATCH 8/8] tools/thermal: tmon: silence 'set but not used' warnings Brian Norris
2015-02-18 2:18 ` Brian Norris
2015-02-18 6:02 ` [PATCH 0/8] tools/thermal: tmon: UI and build system improvements Jacob Pan
2015-02-18 6:02 ` Jacob Pan
2015-02-18 17:49 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424225916-13488-4-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=javi.merino@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.