From e051dd3dadc689e8cf12f813b7e80638dca16f3c Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 12 Mar 2010 10:48:12 -0300 Subject: [PATCH] --- yaml --- r: 191081 b: refs/heads/master c: 7081e087b90d4eb4348f7970bd6b266d837321ef h: refs/heads/master i: 191079: 188a8ebf7486bbd5676c5c10adb3f0abd2708c75 v: v3 --- [refs] | 2 +- trunk/tools/perf/util/newt.c | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 8bd3783823f4..4f4a8b42b0ae 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f9224c5c944b60cf709db4adf1f5195264b8d194 +refs/heads/master: 7081e087b90d4eb4348f7970bd6b266d837321ef diff --git a/trunk/tools/perf/util/newt.c b/trunk/tools/perf/util/newt.c index 3d3a936acb67..2a4308a29ba8 100644 --- a/trunk/tools/perf/util/newt.c +++ b/trunk/tools/perf/util/newt.c @@ -4,6 +4,7 @@ #include #include +#include #include "cache.h" #include "hist.h" @@ -11,6 +12,22 @@ #include "sort.h" #include "symbol.h" +static void newt_form__set_exit_keys(newtComponent self) +{ + newtFormAddHotKey(self, NEWT_KEY_ESCAPE); + newtFormAddHotKey(self, 'Q'); + newtFormAddHotKey(self, 'q'); + newtFormAddHotKey(self, CTRL('c')); +} + +static newtComponent newt_form__new(void) +{ + newtComponent self = newtForm(NULL, NULL, 0); + if (self) + newt_form__set_exit_keys(self); + return self; +} + static size_t hist_entry__append_browser(struct hist_entry *self, newtComponent listbox, u64 total) { @@ -77,8 +94,7 @@ static void hist_entry__annotate_browser(struct hist_entry *self) newtListboxSetWidth(listbox, max_line_len); newtCenteredWindow(max_line_len + 2, ws.ws_row - 5, self->sym->name); - form = newtForm(NULL, NULL, 0); - newtFormAddHotKey(form, NEWT_KEY_ESCAPE); + form = newt_form__new(); newtFormAddComponents(form, listbox, NULL); newtFormRun(form, &es); @@ -108,8 +124,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total, get_term_dimensions(&ws); - form = newtForm(NULL, NULL, 0); - newtFormAddHotKey(form, NEWT_KEY_ESCAPE); + form = newt_form__new(); listbox = newtListbox(1, 1, ws.ws_row - 2, (NEWT_FLAG_SCROLL | NEWT_FLAG_BORDER |