perf newt: Add 'Q', 'q' and Ctrl+C as ways to exit from forms
These are keys people expect when pressed to exit the current widget, so have associate all of them to this semantic. Suggested-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1268401692-9361-1-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
f9224c5c94
commit
7081e087b9
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <newt.h>
|
#include <newt.h>
|
||||||
|
#include <sys/ttydefaults.h>
|
||||||
|
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "hist.h"
|
#include "hist.h"
|
||||||
|
@ -11,6 +12,22 @@
|
||||||
#include "sort.h"
|
#include "sort.h"
|
||||||
#include "symbol.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,
|
static size_t hist_entry__append_browser(struct hist_entry *self,
|
||||||
newtComponent listbox, u64 total)
|
newtComponent listbox, u64 total)
|
||||||
{
|
{
|
||||||
|
@ -77,8 +94,7 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
|
||||||
newtListboxSetWidth(listbox, max_line_len);
|
newtListboxSetWidth(listbox, max_line_len);
|
||||||
|
|
||||||
newtCenteredWindow(max_line_len + 2, ws.ws_row - 5, self->sym->name);
|
newtCenteredWindow(max_line_len + 2, ws.ws_row - 5, self->sym->name);
|
||||||
form = newtForm(NULL, NULL, 0);
|
form = newt_form__new();
|
||||||
newtFormAddHotKey(form, NEWT_KEY_ESCAPE);
|
|
||||||
newtFormAddComponents(form, listbox, NULL);
|
newtFormAddComponents(form, listbox, NULL);
|
||||||
|
|
||||||
newtFormRun(form, &es);
|
newtFormRun(form, &es);
|
||||||
|
@ -108,8 +124,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
|
||||||
|
|
||||||
get_term_dimensions(&ws);
|
get_term_dimensions(&ws);
|
||||||
|
|
||||||
form = newtForm(NULL, NULL, 0);
|
form = newt_form__new();
|
||||||
newtFormAddHotKey(form, NEWT_KEY_ESCAPE);
|
|
||||||
|
|
||||||
listbox = newtListbox(1, 1, ws.ws_row - 2, (NEWT_FLAG_SCROLL |
|
listbox = newtListbox(1, 1, ws.ws_row - 2, (NEWT_FLAG_SCROLL |
|
||||||
NEWT_FLAG_BORDER |
|
NEWT_FLAG_BORDER |
|
||||||
|
|
Reference in New Issue