aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browsers/hists.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-12 12:37:51 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-08-19 19:44:18 -0300
commit4c1c952e37c7511a52f617ceddbc10c855d45d7b (patch)
tree8f2ffa7d5b787b23cf88ea84309d7961e79d9c01 /tools/perf/util/ui/browsers/hists.c
parentperf ui browser: Return the exit key in all browsers (diff)
downloadlinux-dev-4c1c952e37c7511a52f617ceddbc10c855d45d7b.tar.xz
linux-dev-4c1c952e37c7511a52f617ceddbc10c855d45d7b.zip
perf ui browser: Add routines to compactly specify exit keys
This makes the usual idiom for specifying a series of key codes to exit ui_browser__run() for specialized processing (search, annotate, etc) or plain exiting the browser more compact. It also abstracts away some more libnewt operations. At some point we'll also replace NEWT_KEY_foo with something that can be mapped to NEWT or, say, gtk. 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 '')
-rw-r--r--tools/perf/util/ui/browsers/hists.c13
1 files changed, 3 insertions, 10 deletions
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);