lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 12 Mar 2010 10:48:12 -0300
From:	Arnaldo Carvalho de Melo <acme@...radead.org>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Frédéric Weisbecker <fweisbec@...il.com>,
	Mike Galbraith <efault@....de>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>
Subject: [PATCH 1/1] perf newt: Add 'Q', 'q' and Ctrl+C as ways to exit from forms

From: Arnaldo Carvalho de Melo <acme@...hat.com>

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@...e.hu>
Cc: Frédéric Weisbecker <fweisbec@...il.com>
Cc: Mike Galbraith <efault@....de>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/newt.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 3d3a936..2a4308a 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include <newt.h>
+#include <sys/ttydefaults.h>
 
 #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 |
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ