aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-11 09:07:43 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-08-19 18:39:52 -0400
commitb50e003db13848dd74572ffd221047683313981d (patch)
tree84c50dd8f8251ffbb05bfa83b21f4a1e864efc63 /tools/perf/util/ui/browsers/annotate.c
parent8f9bbc408b6f704e84d0ae78e6093005ad58d4fe (diff)
perf ui browser: Return the exit key in all browsers
Make all browsers return the exit key uniformly and remove the newtExitStruct parameter, removing one more newt specific thing from the ui API. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/browsers/annotate.c')
-rw-r--r--tools/perf/util/ui/browsers/annotate.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index a00d529caaf..a8bc2c01594 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -133,14 +133,14 @@ static void annotate_browser__set_top(struct annotate_browser *self,
133 self->curr_hot = nd; 133 self->curr_hot = nd;
134} 134}
135 135
136static int annotate_browser__run(struct annotate_browser *self, 136static int annotate_browser__run(struct annotate_browser *self)
137 struct newtExitStruct *es)
138{ 137{
139 struct rb_node *nd; 138 struct rb_node *nd;
140 struct hist_entry *he = self->b.priv; 139 struct hist_entry *he = self->b.priv;
140 int key;
141 141
142 if (ui_browser__show(&self->b, he->ms.sym->name, 142 if (ui_browser__show(&self->b, he->ms.sym->name,
143 "<- or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0) 143 "<-, -> or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0)
144 return -1; 144 return -1;
145 145
146 newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); 146 newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
@@ -153,12 +153,9 @@ static int annotate_browser__run(struct annotate_browser *self,
153 } 153 }
154 154
155 while (1) { 155 while (1) {
156 ui_browser__run(&self->b, es); 156 key = ui_browser__run(&self->b);
157 157
158 if (es->reason != NEWT_EXIT_HOTKEY) 158 switch (key) {
159 break;
160
161 switch (es->u.key) {
162 case NEWT_KEY_TAB: 159 case NEWT_KEY_TAB:
163 nd = rb_prev(nd); 160 nd = rb_prev(nd);
164 if (nd == NULL) 161 if (nd == NULL)
@@ -177,12 +174,11 @@ static int annotate_browser__run(struct annotate_browser *self,
177 } 174 }
178out: 175out:
179 ui_browser__hide(&self->b); 176 ui_browser__hide(&self->b);
180 return es->u.key; 177 return key;
181} 178}
182 179
183int hist_entry__tui_annotate(struct hist_entry *self) 180int hist_entry__tui_annotate(struct hist_entry *self)
184{ 181{
185 struct newtExitStruct es;
186 struct objdump_line *pos, *n; 182 struct objdump_line *pos, *n;
187 struct objdump_line_rb_node *rbpos; 183 struct objdump_line_rb_node *rbpos;
188 LIST_HEAD(head); 184 LIST_HEAD(head);
@@ -230,7 +226,7 @@ int hist_entry__tui_annotate(struct hist_entry *self)
230 annotate_browser__set_top(&browser, browser.curr_hot); 226 annotate_browser__set_top(&browser, browser.curr_hot);
231 227
232 browser.b.width += 18; /* Percentage */ 228 browser.b.width += 18; /* Percentage */
233 ret = annotate_browser__run(&browser, &es); 229 ret = annotate_browser__run(&browser);
234 list_for_each_entry_safe(pos, n, &head, node) { 230 list_for_each_entry_safe(pos, n, &head, node) {
235 list_del(&pos->node); 231 list_del(&pos->node);
236 objdump_line__free(pos); 232 objdump_line__free(pos);