perf ui browser: Remove ui_browser__add_exit_keys

Users (hist_browser, etc) should just handle all keys, discarding the
ones they don't handle.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-fjouann12v2k58t6vdd2wawb@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3af6e338
...@@ -142,20 +142,6 @@ void ui_browser__reset_index(struct ui_browser *self) ...@@ -142,20 +142,6 @@ void ui_browser__reset_index(struct ui_browser *self)
self->seek(self, 0, SEEK_SET); self->seek(self, 0, SEEK_SET);
} }
void ui_browser__add_exit_key(struct ui_browser *browser __used, int key __used)
{
}
void ui_browser__add_exit_keys(struct ui_browser *self, int keys[])
{
int i = 0;
while (keys[i] && i < 64) {
ui_browser__add_exit_key(self, keys[i]);
++i;
}
}
void __ui_browser__show_title(struct ui_browser *browser, const char *title) void __ui_browser__show_title(struct ui_browser *browser, const char *title)
{ {
SLsmg_gotorc(0, 0); SLsmg_gotorc(0, 0);
...@@ -175,16 +161,12 @@ int ui_browser__show(struct ui_browser *self, const char *title, ...@@ -175,16 +161,12 @@ int ui_browser__show(struct ui_browser *self, const char *title,
{ {
int err; int err;
va_list ap; va_list ap;
int keys[] = { NEWT_KEY_UP, NEWT_KEY_DOWN, NEWT_KEY_PGUP,
NEWT_KEY_PGDN, NEWT_KEY_HOME, NEWT_KEY_END, ' ',
NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 };
ui_browser__refresh_dimensions(self); ui_browser__refresh_dimensions(self);
pthread_mutex_lock(&ui__lock); pthread_mutex_lock(&ui__lock);
__ui_browser__show_title(self, title); __ui_browser__show_title(self, title);
ui_browser__add_exit_keys(self, keys);
self->title = title; self->title = title;
free(self->helpline); free(self->helpline);
self->helpline = NULL; self->helpline = NULL;
......
...@@ -32,8 +32,6 @@ void ui_browser__refresh_dimensions(struct ui_browser *self); ...@@ -32,8 +32,6 @@ void ui_browser__refresh_dimensions(struct ui_browser *self);
void ui_browser__reset_index(struct ui_browser *self); void ui_browser__reset_index(struct ui_browser *self);
void ui_browser__gotorc(struct ui_browser *self, int y, int x); void ui_browser__gotorc(struct ui_browser *self, int y, int x);
void ui_browser__add_exit_key(struct ui_browser *self, int key);
void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]);
void __ui_browser__show_title(struct ui_browser *browser, const char *title); void __ui_browser__show_title(struct ui_browser *browser, const char *title);
void ui_browser__show_title(struct ui_browser *browser, const char *title); void ui_browser__show_title(struct ui_browser *browser, const char *title);
int ui_browser__show(struct ui_browser *self, const char *title, int ui_browser__show(struct ui_browser *self, const char *title,
......
...@@ -175,12 +175,6 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, ...@@ -175,12 +175,6 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
struct rb_node *nd = NULL; struct rb_node *nd = NULL;
struct map_symbol *ms = self->b.priv; struct map_symbol *ms = self->b.priv;
struct symbol *sym = ms->sym; struct symbol *sym = ms->sym;
/*
* RIGHT To allow builtin-annotate to cycle thru multiple symbols by
* examining the exit key for this function.
*/
int exit_keys[] = { 'H', NEWT_KEY_TAB, NEWT_KEY_UNTAB,
NEWT_KEY_RIGHT, NEWT_KEY_ENTER, 0 };
int key; int key;
if (ui_browser__show(&self->b, sym->name, if (ui_browser__show(&self->b, sym->name,
...@@ -188,7 +182,6 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, ...@@ -188,7 +182,6 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
"cycle hottest lines, H: Hottest, -> Line action") < 0) "cycle hottest lines, H: Hottest, -> Line action") < 0)
return -1; return -1;
ui_browser__add_exit_keys(&self->b, exit_keys);
annotate_browser__calc_percent(self, evidx); annotate_browser__calc_percent(self, evidx);
if (self->curr_hot) if (self->curr_hot)
...@@ -292,8 +285,11 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, ...@@ -292,8 +285,11 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
timer, arg, delay_secs); timer, arg, delay_secs);
} }
break; break;
default: case 'q':
case CTRL('c'):
goto out; goto out;
default:
continue;
} }
if (nd != NULL) if (nd != NULL)
......
...@@ -302,9 +302,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, ...@@ -302,9 +302,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name,
{ {
int key; int key;
char title[160]; char title[160];
int sym_exit_keys[] = { 'a', 'h', 'C', 'd', 'E', 't', 0, };
int exit_keys[] = { '?', 'h', 'D', NEWT_KEY_LEFT, NEWT_KEY_RIGHT,
NEWT_KEY_TAB, NEWT_KEY_UNTAB, NEWT_KEY_ENTER, 0, };
self->b.entries = &self->hists->entries; self->b.entries = &self->hists->entries;
self->b.nr_entries = self->hists->nr_entries; self->b.nr_entries = self->hists->nr_entries;
...@@ -317,10 +314,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name, ...@@ -317,10 +314,6 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name,
"Press '?' for help on key bindings") < 0) "Press '?' for help on key bindings") < 0)
return -1; return -1;
ui_browser__add_exit_keys(&self->b, exit_keys);
if (self->has_symbols)
ui_browser__add_exit_keys(&self->b, sym_exit_keys);
while (1) { while (1) {
key = ui_browser__run(&self->b, delay_secs); key = ui_browser__run(&self->b, delay_secs);
...@@ -921,8 +914,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, ...@@ -921,8 +914,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
!ui__dialog_yesno("Do you really want to exit?")) !ui__dialog_yesno("Do you really want to exit?"))
continue; continue;
/* Fall thru */ /* Fall thru */
default: case 'q':
case CTRL('c'):
goto out_free_stack; goto out_free_stack;
default:
continue;
} }
if (!browser->has_symbols) if (!browser->has_symbols)
...@@ -1056,7 +1052,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -1056,7 +1052,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
int nr_events, const char *help, int nr_events, const char *help,
void(*timer)(void *arg), void *arg, int delay_secs) void(*timer)(void *arg), void *arg, int delay_secs)
{ {
int exit_keys[] = { NEWT_KEY_ENTER, NEWT_KEY_RIGHT, 0, };
struct perf_evlist *evlist = menu->b.priv; struct perf_evlist *evlist = menu->b.priv;
struct perf_evsel *pos; struct perf_evsel *pos;
const char *ev_name, *title = "Available samples"; const char *ev_name, *title = "Available samples";
...@@ -1066,8 +1061,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -1066,8 +1061,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
"ESC: exit, ENTER|->: Browse histograms") < 0) "ESC: exit, ENTER|->: Browse histograms") < 0)
return -1; return -1;
ui_browser__add_exit_keys(&menu->b, exit_keys);
while (1) { while (1) {
key = ui_browser__run(&menu->b, delay_secs); key = ui_browser__run(&menu->b, delay_secs);
...@@ -1091,15 +1084,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -1091,15 +1084,6 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
break; break;
case NEWT_KEY_LEFT: case NEWT_KEY_LEFT:
continue; continue;
case NEWT_KEY_ESCAPE:
if (!ui__dialog_yesno("Do you really want to exit?"))
continue;
/* Fall thru */
default:
goto out;
}
switch (key) {
case NEWT_KEY_TAB: case NEWT_KEY_TAB:
if (pos->node.next == &evlist->entries) if (pos->node.next == &evlist->entries)
pos = list_entry(evlist->entries.next, struct perf_evsel, node); pos = list_entry(evlist->entries.next, struct perf_evsel, node);
...@@ -1114,6 +1098,10 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -1114,6 +1098,10 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
pos = list_entry(pos->node.prev, struct perf_evsel, node); pos = list_entry(pos->node.prev, struct perf_evsel, node);
perf_evlist__set_selected(evlist, pos); perf_evlist__set_selected(evlist, pos);
goto browse_hists; goto browse_hists;
case NEWT_KEY_ESCAPE:
if (!ui__dialog_yesno("Do you really want to exit?"))
continue;
/* Fall thru */
case 'q': case 'q':
case CTRL('c'): case CTRL('c'):
goto out; goto out;
......
...@@ -109,9 +109,6 @@ static int map_browser__run(struct map_browser *self) ...@@ -109,9 +109,6 @@ static int map_browser__run(struct map_browser *self)
verbose ? "" : "restart with -v to use") < 0) verbose ? "" : "restart with -v to use") < 0)
return -1; return -1;
if (verbose)
ui_browser__add_exit_key(&self->b, '/');
while (1) { while (1) {
key = ui_browser__run(&self->b, 0); key = ui_browser__run(&self->b, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment