4 #include "../../util/cache.h"
5 #include "../../util/debug.h"
6 #include "../browser.h"
7 #include "../helpline.h"
10 #include "../libslang.h"
11 #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 ui__signal(int sig)
104 SLtt_get_screen_size();
106 err = SLsmg_init_smg();
109 err = SLang_init_tty(0, 0, 0);
115 pr_err("TUI initialization failed.\n");
119 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
123 tui_progress__init();
125 signal(SIGSEGV, ui__signal);
126 signal(SIGFPE, ui__signal);
127 signal(SIGINT, ui__signal);
128 signal(SIGQUIT, ui__signal);
129 signal(SIGTERM, ui__signal);
131 perf_error__register(&perf_tui_eops);
133 hist_browser__init_hpp();
138 void ui__exit(bool wait_for_ok)
141 ui__question_window("Fatal Error",
142 ui_helpline__last_msg,
143 "Press any key...", 0);
145 SLtt_set_cursor_visibility(1);
150 perf_error__unregister(&perf_tui_eops);