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"
13 static volatile int ui__need_resize
;
15 extern struct perf_error_ops perf_tui_eops
;
17 extern void hist_browser__init_hpp(void);
19 void ui__refresh_dimensions(bool force
)
21 if (force
|| ui__need_resize
) {
23 pthread_mutex_lock(&ui__lock
);
24 SLtt_get_screen_size();
26 pthread_mutex_unlock(&ui__lock
);
30 static void ui__sigwinch(int sig __maybe_unused
)
35 static void ui__setup_sigwinch(void)
43 pthread__unblock_sigwinch();
44 signal(SIGWINCH
, ui__sigwinch
);
47 int ui__getch(int delay_secs
)
49 struct timeval timeout
, *ptimeout
= delay_secs
? &timeout
: NULL
;
59 timeout
.tv_sec
= delay_secs
;
63 err
= select(1, &read_set
, NULL
, NULL
, ptimeout
);
82 err
= select(1, &read_set
, NULL
, NULL
, &timeout
);
90 static void ui__signal(int sig
)
103 SLtt_get_screen_size();
105 err
= SLsmg_init_smg();
108 err
= SLang_init_tty(0, 0, 0);
114 pr_err("TUI initialization failed.\n");
118 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB
);
124 signal(SIGSEGV
, ui__signal
);
125 signal(SIGFPE
, ui__signal
);
126 signal(SIGINT
, ui__signal
);
127 signal(SIGQUIT
, ui__signal
);
128 signal(SIGTERM
, ui__signal
);
130 perf_error__register(&perf_tui_eops
);
132 hist_browser__init_hpp();
137 void ui__exit(bool wait_for_ok
)
140 ui__question_window("Fatal Error",
141 ui_helpline__last_msg
,
142 "Press any key...", 0);
144 SLtt_set_cursor_visibility(1);
149 perf_error__unregister(&perf_tui_eops
);