aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-12 10:46:47 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-12 14:31:53 -0500
commitcb7afb7092bc502b890f0a897ffd67c2b078d347 (patch)
treedaf93933b6ba33a5a96a38b590a7c151ce79db14 /tools
parent7081e087b90d4eb4348f7970bd6b266d837321ef (diff)
perf newt: Use newtGetScreenSize
For consistency, use the newt API more fully. Signed-off-by: Arnaldo 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: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/newt.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 2a4308a29ba8..f6ec6f5c0fd9 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -52,7 +52,7 @@ static size_t hist_entry__append_browser(struct hist_entry *self,
52static void hist_entry__annotate_browser(struct hist_entry *self) 52static void hist_entry__annotate_browser(struct hist_entry *self)
53{ 53{
54 FILE *fp; 54 FILE *fp;
55 struct winsize ws; 55 int cols, rows;
56 newtComponent form, listbox; 56 newtComponent form, listbox;
57 struct newtExitStruct es; 57 struct newtExitStruct es;
58 char *str; 58 char *str;
@@ -71,8 +71,8 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
71 goto out_free_str; 71 goto out_free_str;
72 72
73 newtPushHelpLine("Press ESC to exit"); 73 newtPushHelpLine("Press ESC to exit");
74 get_term_dimensions(&ws); 74 newtGetScreenSize(&cols, &rows);
75 listbox = newtListbox(0, 0, ws.ws_row - 5, NEWT_FLAG_SCROLL); 75 listbox = newtListbox(0, 0, rows - 5, NEWT_FLAG_SCROLL);
76 76
77 while (!feof(fp)) { 77 while (!feof(fp)) {
78 if (getline(&line, &line_len, fp) < 0 || !line_len) 78 if (getline(&line, &line_len, fp) < 0 || !line_len)
@@ -87,13 +87,13 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
87 fclose(fp); 87 fclose(fp);
88 free(line); 88 free(line);
89 89
90 max_usable_width = ws.ws_col - 22; 90 max_usable_width = cols - 22;
91 if (max_line_len > max_usable_width) 91 if (max_line_len > max_usable_width)
92 max_line_len = max_usable_width; 92 max_line_len = max_usable_width;
93 93
94 newtListboxSetWidth(listbox, max_line_len); 94 newtListboxSetWidth(listbox, max_line_len);
95 95
96 newtCenteredWindow(max_line_len + 2, ws.ws_row - 5, self->sym->name); 96 newtCenteredWindow(max_line_len + 2, rows - 5, self->sym->name);
97 form = newt_form__new(); 97 form = newt_form__new();
98 newtFormAddComponents(form, listbox, NULL); 98 newtFormAddComponents(form, listbox, NULL);
99 99
@@ -112,7 +112,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
112 struct rb_node *nd; 112 struct rb_node *nd;
113 unsigned int width; 113 unsigned int width;
114 char *col_width = symbol_conf.col_width_list_str; 114 char *col_width = symbol_conf.col_width_list_str;
115 struct winsize ws; 115 int rows;
116 size_t max_len = 0; 116 size_t max_len = 0;
117 char str[1024]; 117 char str[1024];
118 newtComponent form, listbox; 118 newtComponent form, listbox;
@@ -122,13 +122,13 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
122 newtDrawRootText(0, 0, str); 122 newtDrawRootText(0, 0, str);
123 newtPushHelpLine(helpline); 123 newtPushHelpLine(helpline);
124 124
125 get_term_dimensions(&ws); 125 newtGetScreenSize(NULL, &rows);
126 126
127 form = newt_form__new(); 127 form = newt_form__new();
128 128
129 listbox = newtListbox(1, 1, ws.ws_row - 2, (NEWT_FLAG_SCROLL | 129 listbox = newtListbox(1, 1, rows - 2, (NEWT_FLAG_SCROLL |
130 NEWT_FLAG_BORDER | 130 NEWT_FLAG_BORDER |
131 NEWT_FLAG_RETURNEXIT)); 131 NEWT_FLAG_RETURNEXIT));
132 132
133 list_for_each_entry(se, &hist_entry__sort_list, list) { 133 list_for_each_entry(se, &hist_entry__sort_list, list) {
134 if (se->elide) 134 if (se->elide)