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@gmail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
a90b6b006c
commit
0e7b766dc0
@ -274,11 +274,14 @@ const char DIAG_TITLE[] = "[ TUNABLES ]";
|
|||||||
void show_dialogue(void)
|
void show_dialogue(void)
|
||||||
{
|
{
|
||||||
int j, x = 0, y = 0;
|
int j, x = 0, y = 0;
|
||||||
|
int rows, cols;
|
||||||
WINDOW *w = dialogue_window;
|
WINDOW *w = dialogue_window;
|
||||||
|
|
||||||
if (tui_disabled || !w)
|
if (tui_disabled || !w)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
getmaxyx(w, rows, cols);
|
||||||
|
|
||||||
werase(w);
|
werase(w);
|
||||||
box(w, 0, 0);
|
box(w, 0, 0);
|
||||||
mvwprintw(w, 0, maxx/4, DIAG_TITLE);
|
mvwprintw(w, 0, maxx/4, DIAG_TITLE);
|
||||||
@ -297,10 +300,8 @@ void show_dialogue(void)
|
|||||||
wattron(w, A_BOLD);
|
wattron(w, A_BOLD);
|
||||||
mvwprintw(w, DIAG_DEV_ROWS+1, 1, "Enter Choice [A-Z]?");
|
mvwprintw(w, DIAG_DEV_ROWS+1, 1, "Enter Choice [A-Z]?");
|
||||||
wattroff(w, A_BOLD);
|
wattroff(w, A_BOLD);
|
||||||
/* y size of dialogue win is nr cdev + 5, so print legend
|
/* print legend at the bottom line */
|
||||||
* at the bottom line
|
mvwprintw(w, rows - 2, 1,
|
||||||
*/
|
|
||||||
mvwprintw(w, ptdata.nr_cooling_dev+3, 1,
|
|
||||||
"Legend: A=Active, P=Passive, C=Critical");
|
"Legend: A=Active, P=Passive, C=Critical");
|
||||||
|
|
||||||
wrefresh(dialogue_window);
|
wrefresh(dialogue_window);
|
||||||
|
Loading…
Reference in New Issue
Block a user