Define winch_flag as volatile sig_atomic_t.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-10-31 10:48:56 +04:00
parent 6cbe12d968
commit 1463d550b0
7 changed files with 12 additions and 9 deletions

View File

@ -101,7 +101,7 @@ mc_global_t mc_global = {
.ugly_line_drawing = FALSE, .ugly_line_drawing = FALSE,
.old_mouse = FALSE, .old_mouse = FALSE,
.alternate_plus_minus = FALSE, .alternate_plus_minus = FALSE,
.winch_flag = FALSE .winch_flag = 0
}, },
.vfs = .vfs =

View File

@ -21,6 +21,9 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
/* for sig_atomic_t */
#include <signal.h>
/*** typedefs(not structures) and defined constants **********************************************/ /*** typedefs(not structures) and defined constants **********************************************/
/* The O_BINARY definition was taken from gettext */ /* The O_BINARY definition was taken from gettext */
@ -258,7 +261,7 @@ typedef struct
gboolean alternate_plus_minus; gboolean alternate_plus_minus;
/* Set if the window has changed it's size */ /* Set if the window has changed it's size */
gboolean winch_flag; volatile sig_atomic_t winch_flag;
} tty; } tty;
struct struct

View File

@ -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_addr = &time_out;
time_out.tv_sec = 0; time_out.tv_sec = 0;
@ -2126,7 +2126,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
{ {
if (redo_event) if (redo_event)
return EV_MOUSE; return EV_MOUSE;
if (!block || mc_global.tty.winch_flag) if (!block || mc_global.tty.winch_flag != 0)
return EV_NONE; return EV_NONE;
vfs_timeout_handler (); vfs_timeout_handler ();
} }

View File

@ -98,7 +98,7 @@ sigwinch_handler (int dummy)
{ {
(void) dummy; (void) dummy;
mc_global.tty.winch_flag = TRUE; mc_global.tty.winch_flag = 1;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

View File

@ -154,7 +154,7 @@ sigwinch_handler (int dummy)
(void) dummy; (void) dummy;
tty_change_screen_size (); tty_change_screen_size ();
mc_global.tty.winch_flag = TRUE; mc_global.tty.winch_flag = 1;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

View File

@ -358,7 +358,7 @@ mc_refresh (void)
if (mc_global.we_are_background) if (mc_global.we_are_background)
return; return;
#endif /* ENABLE_BACKGROUND */ #endif /* ENABLE_BACKGROUND */
if (!mc_global.tty.winch_flag) if (mc_global.tty.winch_flag == 0)
tty_refresh (); tty_refresh ();
else else
{ {
@ -373,7 +373,7 @@ mc_refresh (void)
void void
dialog_change_screen_size (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(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
#if defined TIOCGWINSZ #if defined TIOCGWINSZ

View File

@ -532,7 +532,7 @@ frontend_run_dlg (Dlg_head * h)
while (h->state == DLG_ACTIVE) while (h->state == DLG_ACTIVE)
{ {
if (mc_global.tty.winch_flag) if (mc_global.tty.winch_flag != 0)
dialog_change_screen_size (); dialog_change_screen_size ();
if (is_idle ()) if (is_idle ())