14 pthread_mutex_t ui__lock
= PTHREAD_MUTEX_INITIALIZER
;
16 static volatile int ui__need_resize
;
18 void ui__refresh_dimensions(bool force
)
20 if (force
|| ui__need_resize
) {
22 pthread_mutex_lock(&ui__lock
);
23 SLtt_get_screen_size();
25 pthread_mutex_unlock(&ui__lock
);
29 static void ui__sigwinch(int sig __used
)
34 static void ui__setup_sigwinch(void)
42 pthread__unblock_sigwinch();
43 signal(SIGWINCH
, ui__sigwinch
);
46 int ui__getch(int delay_secs
)
48 struct timeval timeout
, *ptimeout
= delay_secs
? &timeout
: NULL
;
58 timeout
.tv_sec
= delay_secs
;
62 err
= select(1, &read_set
, NULL
, NULL
, ptimeout
);
81 err
= select(1, &read_set
, NULL
, NULL
, &timeout
);
89 static void newt_suspend(void *d __used
)
96 static int ui__init(void)
98 int err
= SLkp_init();
103 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB
);
108 static void ui__exit(void)
110 SLtt_set_cursor_visibility(1);
116 static void ui__signal(int sig
)
119 psignal(sig
, "perf");
123 void setup_browser(bool fallback_to_pager
)
125 if (!isatty(1) || !use_browser
|| dump_trace
) {
127 if (fallback_to_pager
)
135 newtSetSuspendCallback(newt_suspend
, NULL
);
139 signal(SIGSEGV
, ui__signal
);
140 signal(SIGFPE
, ui__signal
);
141 signal(SIGINT
, ui__signal
);
142 signal(SIGQUIT
, ui__signal
);
143 signal(SIGTERM
, ui__signal
);
146 void exit_browser(bool wait_for_ok
)
148 if (use_browser
> 0) {
150 ui__question_window("Fatal Error",
151 ui_helpline__last_msg
,
152 "Press any key...", 0);