mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Added SIGWINCH handler
This commit is contained in:
parent
fe10f2b2e3
commit
e6f27de552
@ -41,6 +41,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef HAVE_LIBXSS
|
#ifdef HAVE_LIBXSS
|
||||||
#include <X11/extensions/scrnsaver.h>
|
#include <X11/extensions/scrnsaver.h>
|
||||||
#endif
|
#endif
|
||||||
@ -91,7 +94,6 @@ ui_init(void)
|
|||||||
{
|
{
|
||||||
log_info("Initialising UI");
|
log_info("Initialising UI");
|
||||||
initscr();
|
initscr();
|
||||||
raw();
|
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
if (prefs_get_boolean(PREF_MOUSE)) {
|
if (prefs_get_boolean(PREF_MOUSE)) {
|
||||||
mousemask(ALL_MOUSE_EVENTS, NULL);
|
mousemask(ALL_MOUSE_EVENTS, NULL);
|
||||||
@ -221,9 +223,13 @@ ui_input_nonblocking(gboolean reset)
|
|||||||
void
|
void
|
||||||
ui_resize(void)
|
ui_resize(void)
|
||||||
{
|
{
|
||||||
log_info("Resizing UI");
|
struct winsize w;
|
||||||
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||||
erase();
|
erase();
|
||||||
|
resizeterm(w.ws_row, w.ws_col);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
log_info("Resizing UI");
|
||||||
title_bar_resize();
|
title_bar_resize();
|
||||||
wins_resize_all();
|
wins_resize_all();
|
||||||
status_bar_resize();
|
status_bar_resize();
|
||||||
|
@ -114,6 +114,12 @@ tab_handler(int count, int key)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
resize_signal_handler(int signal)
|
||||||
|
{
|
||||||
|
ui_resize();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
create_input_window(void)
|
create_input_window(void)
|
||||||
{
|
{
|
||||||
@ -127,10 +133,13 @@ create_input_window(void)
|
|||||||
rl_callback_handler_install(NULL, cb_linehandler);
|
rl_callback_handler_install(NULL, cb_linehandler);
|
||||||
rl_bind_key('\t', tab_handler);
|
rl_bind_key('\t', tab_handler);
|
||||||
|
|
||||||
|
signal(SIGWINCH, resize_signal_handler);
|
||||||
|
|
||||||
inp_win = newpad(1, INP_WIN_MAX);
|
inp_win = newpad(1, INP_WIN_MAX);
|
||||||
wbkgd(inp_win, theme_attrs(THEME_INPUT_TEXT));;
|
wbkgd(inp_win, theme_attrs(THEME_INPUT_TEXT));;
|
||||||
keypad(inp_win, TRUE);
|
keypad(inp_win, TRUE);
|
||||||
wmove(inp_win, 0, 0);
|
wmove(inp_win, 0, 0);
|
||||||
|
|
||||||
_inp_win_update_virtual();
|
_inp_win_update_virtual();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +242,7 @@ inp_readline(void)
|
|||||||
r = select(FD_SETSIZE, &fds, NULL, NULL, &p_rl_timeout);
|
r = select(FD_SETSIZE, &fds, NULL, NULL, &p_rl_timeout);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_error("Readline failed.");
|
log_error("Readline failed.");
|
||||||
return false;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(fileno(rl_instream), &fds)) {
|
if (FD_ISSET(fileno(rl_instream), &fds)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user