aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browsers/annotate.c
diff options
context:
space:
mode:
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);