TTY: moved SIGWINCH setup function to TTY layer.
Also renamed SIGWINCH signal handler. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
16ceccc6df
Коммит
d1122efe92
@ -676,7 +676,8 @@ setup_panels (void)
|
||||
update_xterm_title_path ();
|
||||
}
|
||||
|
||||
void flag_winch (int dummy)
|
||||
void
|
||||
sigwinch_handler (int dummy)
|
||||
{
|
||||
(void) dummy;
|
||||
#if !(defined(USE_NCURSES) || defined(USE_NCURSESW)) /* don't do malloc in a signal handler */
|
||||
|
@ -12,8 +12,7 @@
|
||||
void layout_cmd (void);
|
||||
void setup_panels (void);
|
||||
void destroy_panels (void);
|
||||
void move_resize_panel (void);
|
||||
void flag_winch (int dummy);
|
||||
void sigwinch_handler (int dummy);
|
||||
void change_screen_size (void);
|
||||
void set_display_type (int num, int type);
|
||||
void swap_panels (void);
|
||||
|
18
src/main.c
18
src/main.c
@ -29,7 +29,6 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -1176,21 +1175,6 @@ static const key_map default_map[] = {
|
||||
{0, 0},
|
||||
};
|
||||
|
||||
static void
|
||||
setup_sigwinch (void)
|
||||
{
|
||||
#if (defined(HAVE_SLANG) || (NCURSES_VERSION_MAJOR >= 4)) && defined(SIGWINCH)
|
||||
struct sigaction act, oact;
|
||||
act.sa_handler = flag_winch;
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
#ifdef SA_RESTART
|
||||
act.sa_flags |= SA_RESTART;
|
||||
#endif
|
||||
sigaction (SIGWINCH, &act, &oact);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
setup_pre (void)
|
||||
{
|
||||
@ -1268,7 +1252,7 @@ setup_mc (void)
|
||||
add_select_channel (subshell_pty, load_prompt, 0);
|
||||
#endif /* !HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
setup_sigwinch ();
|
||||
tty_setup_sigwinch (sigwinch_handler);
|
||||
|
||||
verbose = !((tty_baudrate () < 9600) || tty_is_slow ());
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
@ -325,6 +326,21 @@ tty_refresh (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_setup_sigwinch (void (*handler) (int))
|
||||
{
|
||||
#if (NCURSES_VERSION_MAJOR >= 4) && defined (SIGWINCH)
|
||||
struct sigaction act, oact;
|
||||
act.sa_handler = handler;
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
#ifdef SA_RESTART
|
||||
act.sa_flags |= SA_RESTART;
|
||||
#endif /* SA_RESTART */
|
||||
sigaction (SIGWINCH, &act, &oact);
|
||||
#endif /* SIGWINCH */
|
||||
}
|
||||
|
||||
void
|
||||
tty_beep (void)
|
||||
{
|
||||
|
@ -37,8 +37,9 @@
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
@ -555,6 +556,21 @@ tty_refresh (void)
|
||||
SLsmg_refresh ();
|
||||
}
|
||||
|
||||
void
|
||||
tty_setup_sigwinch (void (*handler) (int))
|
||||
{
|
||||
#ifdef SIGWINCH
|
||||
struct sigaction act, oact;
|
||||
act.sa_handler = handler;
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
#ifdef SA_RESTART
|
||||
act.sa_flags |= SA_RESTART;
|
||||
#endif /* SA_RESTART */
|
||||
sigaction (SIGWINCH, &act, &oact);
|
||||
#endif /* SIGWINCH */
|
||||
}
|
||||
|
||||
void
|
||||
tty_beep (void)
|
||||
{
|
||||
|
@ -85,6 +85,7 @@ extern void tty_beep (void);
|
||||
#define KEY_KP_SUBTRACT 4002
|
||||
#define KEY_KP_MULTIPLY 4003
|
||||
|
||||
void tty_refresh (void);
|
||||
extern void tty_refresh (void);
|
||||
extern void tty_setup_sigwinch (void (*handler) (int));
|
||||
|
||||
#endif /* MC_TTY_H */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user