diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-10 15:58:50 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-10 16:11:38 -0300 |
commit | 1e6dd077a880ba5570beb690523b7a78a91a7615 (patch) | |
tree | 979b2006c8c1b93dfe1f4e2152af5c5c4c7c6531 /tools/perf/util/ui/setup.c | |
parent | d1b4f2491c3341c61c752049f73ba12553f978d8 (diff) | |
download | op-kernel-dev-1e6dd077a880ba5570beb690523b7a78a91a7615.zip op-kernel-dev-1e6dd077a880ba5570beb690523b7a78a91a7615.tar.gz |
perf ui: Complete the breakdown of util/newt.c
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/setup.c')
-rw-r--r-- | tools/perf/util/ui/setup.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/perf/util/ui/setup.c b/tools/perf/util/ui/setup.c new file mode 100644 index 0000000..6620850 --- /dev/null +++ b/tools/perf/util/ui/setup.c @@ -0,0 +1,42 @@ +#include <newt.h> +#include <signal.h> +#include <stdbool.h> + +#include "../cache.h" +#include "../debug.h" +#include "browser.h" +#include "helpline.h" + +static void newt_suspend(void *d __used) +{ + newtSuspend(); + raise(SIGTSTP); + newtResume(); +} + +void setup_browser(void) +{ + if (!isatty(1) || !use_browser || dump_trace) { + use_browser = 0; + setup_pager(); + return; + } + + use_browser = 1; + newtInit(); + newtCls(); + newtSetSuspendCallback(newt_suspend, NULL); + ui_helpline__init(); + ui_browser__init(); +} + +void exit_browser(bool wait_for_ok) +{ + if (use_browser > 0) { + if (wait_for_ok) { + char title[] = "Fatal Error", ok[] = "Ok"; + newtWinMessage(title, ok, ui_helpline__last_msg); + } + newtFinished(); + } +} |