1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Move SIGWINCH handling to ui/core.c, ignore signal whilst resizing

This commit is contained in:
James Booth 2015-02-04 23:35:28 +00:00
parent d64c4a69d7
commit 30180ac8bb
5 changed files with 18 additions and 9 deletions

View File

@ -204,6 +204,7 @@ _init(const int disable_tls, char *log_level)
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGWINCH, ui_sigwinch_handler);
_create_directories();
log_level_t prof_log_level = log_level_from_string(log_level);
prefs_load();

View File

@ -79,6 +79,8 @@ static char *win_title;
static int inp_size;
static gboolean perform_resize = FALSE;
#ifdef HAVE_LIBXSS
static Display *display;
#endif
@ -120,6 +122,12 @@ ui_init(void)
win_update_virtual(window);
}
void
ui_sigwinch_handler(int sig)
{
perform_resize = TRUE;
}
void
ui_update(void)
{
@ -137,6 +145,13 @@ ui_update(void)
status_bar_update_virtual();
inp_put_back();
doupdate();
if (perform_resize) {
signal(SIGWINCH, SIG_IGN);
ui_resize();
perform_resize = FALSE;
signal(SIGWINCH, ui_sigwinch_handler);
}
}
void

View File

@ -79,7 +79,6 @@ static gboolean cmd_result = TRUE;
static void _inp_win_update_virtual(void);
static int _inp_printable(const wint_t ch);
static void _inp_win_handle_scroll(void);
static void _inp_resize_signal_handler(int signal);
static int _inp_offset_to_col(char *str, int offset);
static void _inp_write(char *line, int offset);
@ -125,8 +124,6 @@ create_input_window(void)
rl_startup_hook = _inp_rl_startup_hook;
rl_callback_handler_install(NULL, _inp_rl_linehandler);
signal(SIGWINCH, _inp_resize_signal_handler);
inp_win = newpad(1, INP_WIN_MAX);
wbkgd(inp_win, theme_attrs(THEME_INPUT_TEXT));;
keypad(inp_win, TRUE);
@ -311,12 +308,6 @@ _inp_offset_to_col(char *str, int offset)
return col;
}
static void
_inp_resize_signal_handler(int signal)
{
ui_resize();
}
static void
_inp_win_handle_scroll(void)
{

View File

@ -62,6 +62,7 @@ GSList* ui_get_chat_recipients(void);
gboolean ui_switch_win(const int i);
void ui_next_win(void);
void ui_previous_win(void);
void ui_sigwinch_handler(int sig);
void ui_gone_secure(const char * const barejid, gboolean trusted);
void ui_gone_insecure(const char * const barejid);

View File

@ -91,6 +91,7 @@ void ui_smp_answer_failure(const char * const barejid) {}
void ui_otr_authenticating(const char * const barejid) {}
void ui_otr_authetication_waiting(const char * const recipient) {}
void ui_sigwinch_handler(int sig) {}
unsigned long ui_get_idle_time(void)
{