Commit cb7afb70 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

perf newt: Use newtGetScreenSize

For consistency, use the newt API more fully.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1268408808-13595-1-git-send-email-acme@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7081e087
...@@ -52,7 +52,7 @@ static size_t hist_entry__append_browser(struct hist_entry *self, ...@@ -52,7 +52,7 @@ static size_t hist_entry__append_browser(struct hist_entry *self,
static void hist_entry__annotate_browser(struct hist_entry *self) static void hist_entry__annotate_browser(struct hist_entry *self)
{ {
FILE *fp; FILE *fp;
struct winsize ws; int cols, rows;
newtComponent form, listbox; newtComponent form, listbox;
struct newtExitStruct es; struct newtExitStruct es;
char *str; char *str;
...@@ -71,8 +71,8 @@ static void hist_entry__annotate_browser(struct hist_entry *self) ...@@ -71,8 +71,8 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
goto out_free_str; goto out_free_str;
newtPushHelpLine("Press ESC to exit"); newtPushHelpLine("Press ESC to exit");
get_term_dimensions(&ws); newtGetScreenSize(&cols, &rows);
listbox = newtListbox(0, 0, ws.ws_row - 5, NEWT_FLAG_SCROLL); listbox = newtListbox(0, 0, rows - 5, NEWT_FLAG_SCROLL);
while (!feof(fp)) { while (!feof(fp)) {
if (getline(&line, &line_len, fp) < 0 || !line_len) if (getline(&line, &line_len, fp) < 0 || !line_len)
...@@ -87,13 +87,13 @@ static void hist_entry__annotate_browser(struct hist_entry *self) ...@@ -87,13 +87,13 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
fclose(fp); fclose(fp);
free(line); free(line);
max_usable_width = ws.ws_col - 22; max_usable_width = cols - 22;
if (max_line_len > max_usable_width) if (max_line_len > max_usable_width)
max_line_len = max_usable_width; max_line_len = max_usable_width;
newtListboxSetWidth(listbox, max_line_len); newtListboxSetWidth(listbox, max_line_len);
newtCenteredWindow(max_line_len + 2, ws.ws_row - 5, self->sym->name); newtCenteredWindow(max_line_len + 2, rows - 5, self->sym->name);
form = newt_form__new(); form = newt_form__new();
newtFormAddComponents(form, listbox, NULL); newtFormAddComponents(form, listbox, NULL);
...@@ -112,7 +112,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total, ...@@ -112,7 +112,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
struct rb_node *nd; struct rb_node *nd;
unsigned int width; unsigned int width;
char *col_width = symbol_conf.col_width_list_str; char *col_width = symbol_conf.col_width_list_str;
struct winsize ws; int rows;
size_t max_len = 0; size_t max_len = 0;
char str[1024]; char str[1024];
newtComponent form, listbox; newtComponent form, listbox;
...@@ -122,11 +122,11 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total, ...@@ -122,11 +122,11 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
newtDrawRootText(0, 0, str); newtDrawRootText(0, 0, str);
newtPushHelpLine(helpline); newtPushHelpLine(helpline);
get_term_dimensions(&ws); newtGetScreenSize(NULL, &rows);
form = newt_form__new(); form = newt_form__new();
listbox = newtListbox(1, 1, ws.ws_row - 2, (NEWT_FLAG_SCROLL | listbox = newtListbox(1, 1, rows - 2, (NEWT_FLAG_SCROLL |
NEWT_FLAG_BORDER | NEWT_FLAG_BORDER |
NEWT_FLAG_RETURNEXIT)); NEWT_FLAG_RETURNEXIT));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment