aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browsers
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/ui/browsers')
-rw-r--r--tools/perf/util/ui/browsers/annotate.c12
-rw-r--r--tools/perf/util/ui/browsers/hists.c13
-rw-r--r--tools/perf/util/ui/browsers/map.c8
3 files changed, 11 insertions, 22 deletions
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index a8bc2c015946..82b78f99251b 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -142,14 +142,16 @@ static int annotate_browser__run(struct annotate_browser *self)
if (ui_browser__show(&self->b, he->ms.sym->name,
"<-, -> or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0)
return -1;
-
- newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
- newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
+ /*
+ * To allow builtin-annotate to cycle thru multiple symbols by
+ * examining the exit key for this function.
+ */
+ ui_browser__add_exit_key(&self->b, NEWT_KEY_RIGHT);
nd = self->curr_hot;
if (nd) {
- newtFormAddHotKey(self->b.form, NEWT_KEY_TAB);
- newtFormAddHotKey(self->b.form, NEWT_KEY_UNTAB);
+ int tabs[] = { NEWT_KEY_TAB, NEWT_KEY_UNTAB, 0 };
+ ui_browser__add_exit_keys(&self->b, tabs);
}
while (1) {
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 1735c48691a5..b13b9787be70 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -198,6 +198,8 @@ static bool hist_browser__toggle_fold(struct hist_browser *self)
static int hist_browser__run(struct hist_browser *self, const char *title)
{
int key;
+ int exit_keys[] = { 'a', '?', 'h', 'd', 'D', 't', NEWT_KEY_ENTER,
+ NEWT_KEY_RIGHT, NEWT_KEY_LEFT, 0, };
char str[256], unit;
unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
@@ -215,16 +217,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title)
"Press '?' for help on key bindings") < 0)
return -1;
- newtFormAddHotKey(self->b.form, 'a');
- newtFormAddHotKey(self->b.form, '?');
- newtFormAddHotKey(self->b.form, 'h');
- newtFormAddHotKey(self->b.form, 'd');
- newtFormAddHotKey(self->b.form, 'D');
- newtFormAddHotKey(self->b.form, 't');
-
- newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
- newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
- newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+ ui_browser__add_exit_keys(&self->b, exit_keys);
while (1) {
key = ui_browser__run(&self->b);
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
index 16b7d70f2c58..1bf09796cb31 100644
--- a/tools/perf/util/ui/browsers/map.c
+++ b/tools/perf/util/ui/browsers/map.c
@@ -1,6 +1,5 @@
#include "../libslang.h"
#include <elf.h>
-#include <newt.h>
#include <sys/ttydefaults.h>
#include <ctype.h>
#include <string.h>
@@ -106,13 +105,8 @@ static int map_browser__run(struct map_browser *self)
verbose ? "" : "restart with -v to use") < 0)
return -1;
- newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
- newtFormAddHotKey(self->b.form, NEWT_KEY_ESCAPE);
- newtFormAddHotKey(self->b.form, 'Q');
- newtFormAddHotKey(self->b.form, 'q');
- newtFormAddHotKey(self->b.form, CTRL('c'));
if (verbose)
- newtFormAddHotKey(self->b.form, '/');
+ ui_browser__add_exit_key(&self->b, '/');
while (1) {
key = ui_browser__run(&self->b);