diff --git a/lib/global.c b/lib/global.c index ade80f2f0..a1afc3580 100644 --- a/lib/global.c +++ b/lib/global.c @@ -101,7 +101,7 @@ mc_global_t mc_global = { .ugly_line_drawing = FALSE, .old_mouse = FALSE, .alternate_plus_minus = FALSE, - .winch_flag = FALSE + .winch_flag = 0 }, .vfs = diff --git a/lib/global.h b/lib/global.h index d8e2bef95..505100dca 100644 --- a/lib/global.h +++ b/lib/global.h @@ -21,6 +21,9 @@ #include #endif +/* for sig_atomic_t */ +#include + /*** typedefs(not structures) and defined constants **********************************************/ /* The O_BINARY definition was taken from gettext */ @@ -258,7 +261,7 @@ typedef struct gboolean alternate_plus_minus; /* Set if the window has changed it's size */ - gboolean winch_flag; + volatile sig_atomic_t winch_flag; } tty; struct diff --git a/lib/tty/key.c b/lib/tty/key.c index 1d834e49c..9667652a0 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -2106,7 +2106,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block) } } - if (!block || mc_global.tty.winch_flag) + if (!block || mc_global.tty.winch_flag != 0) { time_addr = &time_out; time_out.tv_sec = 0; @@ -2126,7 +2126,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block) { if (redo_event) return EV_MOUSE; - if (!block || mc_global.tty.winch_flag) + if (!block || mc_global.tty.winch_flag != 0) return EV_NONE; vfs_timeout_handler (); } diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index 67dea4ee9..fe2d4cca0 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -98,7 +98,7 @@ sigwinch_handler (int dummy) { (void) dummy; - mc_global.tty.winch_flag = TRUE; + mc_global.tty.winch_flag = 1; } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index 99af2384b..0800571fc 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -154,7 +154,7 @@ sigwinch_handler (int dummy) (void) dummy; tty_change_screen_size (); - mc_global.tty.winch_flag = TRUE; + mc_global.tty.winch_flag = 1; } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/dialog-switch.c b/lib/widget/dialog-switch.c index 7d851a71c..79a11dce3 100644 --- a/lib/widget/dialog-switch.c +++ b/lib/widget/dialog-switch.c @@ -358,7 +358,7 @@ mc_refresh (void) if (mc_global.we_are_background) return; #endif /* ENABLE_BACKGROUND */ - if (!mc_global.tty.winch_flag) + if (mc_global.tty.winch_flag == 0) tty_refresh (); else { @@ -373,7 +373,7 @@ mc_refresh (void) void dialog_change_screen_size (void) { - mc_global.tty.winch_flag = FALSE; + mc_global.tty.winch_flag = 0; #if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 #if defined TIOCGWINSZ diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c index 0bf4250f2..2aa286b78 100644 --- a/lib/widget/dialog.c +++ b/lib/widget/dialog.c @@ -532,7 +532,7 @@ frontend_run_dlg (Dlg_head * h) while (h->state == DLG_ACTIVE) { - if (mc_global.tty.winch_flag) + if (mc_global.tty.winch_flag != 0) dialog_change_screen_size (); if (is_idle ())