5 #include "../../util/cache.h"
6 #include "../../util/debug.h"
7 #include "../browser.h"
8 #include "../helpline.h"
11 #include "../libslang.h"
12 #include "../keysyms.h"
14 static volatile int ui__need_resize;
16 extern struct perf_error_ops perf_tui_eops;
18 extern void hist_browser__init_hpp(void);
20 void ui__refresh_dimensions(bool force)
22 if (force || ui__need_resize) {
24 pthread_mutex_lock(&ui__lock);
25 SLtt_get_screen_size();
27 pthread_mutex_unlock(&ui__lock);
31 static void ui__sigwinch(int sig __maybe_unused)
36 static void ui__setup_sigwinch(void)
44 pthread__unblock_sigwinch();
45 signal(SIGWINCH, ui__sigwinch);
48 int ui__getch(int delay_secs)
50 struct timeval timeout, *ptimeout = delay_secs ? &timeout : NULL;
60 timeout.tv_sec = delay_secs;
64 err = select(1, &read_set, NULL, NULL, ptimeout);
83 err = select(1, &read_set, NULL, NULL, &timeout);
91 static void newt_suspend(void *d __maybe_unused)
98 static void ui__signal(int sig)
101 psignal(sig, "perf");
112 pr_err("TUI initialization failed.\n");
116 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
118 newtSetSuspendCallback(newt_suspend, NULL);
122 signal(SIGSEGV, ui__signal);
123 signal(SIGFPE, ui__signal);
124 signal(SIGINT, ui__signal);
125 signal(SIGQUIT, ui__signal);
126 signal(SIGTERM, ui__signal);
128 perf_error__register(&perf_tui_eops);
130 hist_browser__init_hpp();
135 void ui__exit(bool wait_for_ok)
138 ui__question_window("Fatal Error",
139 ui_helpline__last_msg,
140 "Press any key...", 0);
142 SLtt_set_cursor_visibility(1);
147 perf_error__unregister(&perf_tui_eops);