Ticket #2907: revert-sigwinch-setup.diff

File revert-sigwinch-setup.diff, 4.4 KB (added by andrew_b, 12 years ago)
  • lib/tty/tty-ncurses.c

    diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
    index 7481a3e..6a66342 100644
    a b static int mc_curs_row, mc_curs_col; 
    8181/*** file scope functions ************************************************************************/ 
    8282/* --------------------------------------------------------------------------------------------- */ 
    8383 
    84 /* --------------------------------------------------------------------------------------------- */ 
    85  
    86 static void 
    87 tty_setup_sigwinch (void (*handler) (int)) 
    88 { 
    89 #if (NCURSES_VERSION_MAJOR >= 4) && defined (SIGWINCH) 
    90     struct sigaction act, oact; 
    91     act.sa_handler = handler; 
    92     sigemptyset (&act.sa_mask); 
    93     act.sa_flags = 0; 
    94 #ifdef SA_RESTART 
    95     act.sa_flags |= SA_RESTART; 
    96 #endif /* SA_RESTART */ 
    97     sigaction (SIGWINCH, &act, &oact); 
    98 #endif /* SIGWINCH */ 
    99 } 
    100  
    101 /* --------------------------------------------------------------------------------------------- */ 
    102  
    10384static void 
    10485sigwinch_handler (int dummy) 
    10586{ 
    tty_init (gboolean mouse_enable, gboolean is_xterm) 
    205186    noecho (); 
    206187    keypad (stdscr, TRUE); 
    207188    nodelay (stdscr, FALSE); 
    208  
    209     tty_setup_sigwinch (sigwinch_handler); 
    210189} 
    211190 
    212191/* --------------------------------------------------------------------------------------------- */ 
    tty_beep (void) 
    630609} 
    631610 
    632611/* --------------------------------------------------------------------------------------------- */ 
     612 
     613void 
     614tty_setup_sigwinch (void) 
     615{ 
     616#if (NCURSES_VERSION_MAJOR >= 4) && defined (SIGWINCH) 
     617    struct sigaction act, oact; 
     618 
     619    act.sa_handler = sigwinch_handler; 
     620    sigemptyset (&act.sa_mask); 
     621    act.sa_flags = 0; 
     622#ifdef SA_RESTART 
     623    act.sa_flags |= SA_RESTART; 
     624#endif /* SA_RESTART */ 
     625    sigaction (SIGWINCH, &act, &oact); 
     626#endif /* SIGWINCH */ 
     627} 
     628 
     629/* --------------------------------------------------------------------------------------------- */ 
  • lib/tty/tty-slang.c

    diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c
    index 6b7fd32..cae30c7 100644
    a b static const struct 
    132132/* --------------------------------------------------------------------------------------------- */ 
    133133 
    134134static void 
    135 tty_setup_sigwinch (void (*handler) (int)) 
    136 { 
    137 #ifdef SIGWINCH 
    138     struct sigaction act, oact; 
    139     act.sa_handler = handler; 
    140     sigemptyset (&act.sa_mask); 
    141     act.sa_flags = 0; 
    142 #ifdef SA_RESTART 
    143     act.sa_flags |= SA_RESTART; 
    144 #endif /* SA_RESTART */ 
    145     sigaction (SIGWINCH, &act, &oact); 
    146 #endif /* SIGWINCH */ 
    147 } 
    148  
    149 /* --------------------------------------------------------------------------------------------- */ 
    150  
    151 static void 
    152135sigwinch_handler (int dummy) 
    153136{ 
    154137    (void) dummy; 
    tty_init (gboolean mouse_enable, gboolean is_xterm) 
    342325    do_enter_ca_mode (); 
    343326    tty_keypad (TRUE); 
    344327    tty_nodelay (FALSE); 
    345  
    346     tty_setup_sigwinch (sigwinch_handler); 
    347328} 
    348329 
    349330/* --------------------------------------------------------------------------------------------- */ 
    tty_beep (void) 
    737718} 
    738719 
    739720/* --------------------------------------------------------------------------------------------- */ 
     721 
     722void 
     723tty_setup_sigwinch (void) 
     724{ 
     725#ifdef SIGWINCH 
     726    struct sigaction act, oact; 
     727 
     728    act.sa_handler = sigwinch_handler; 
     729    sigemptyset (&act.sa_mask); 
     730    act.sa_flags = 0; 
     731#ifdef SA_RESTART 
     732    act.sa_flags |= SA_RESTART; 
     733#endif /* SA_RESTART */ 
     734    sigaction (SIGWINCH, &act, &oact); 
     735#endif /* SIGWINCH */ 
     736} 
     737 
     738/* --------------------------------------------------------------------------------------------- */ 
  • lib/tty/tty.h

    diff --git a/lib/tty/tty.h b/lib/tty/tty.h
    index 0450208..5df0ff4 100644
    a b extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch) 
    130130extern int tty_resize (int fd); 
    131131extern void tty_refresh (void); 
    132132extern void tty_change_screen_size (void); 
     133extern void tty_setup_sigwinch (void); 
    133134 
    134135extern int mc_tty_normalize_lines_char (const char *); 
    135136 
  • src/filemanager/midnight.c

    diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c
    index 0ba2fd8..0ed4f04 100644
    a b setup_mc (void) 
    877877        add_select_channel (mc_global.tty.subshell_pty, load_prompt, 0); 
    878878#endif /* !HAVE_SUBSHELL_SUPPORT */ 
    879879 
     880    tty_setup_sigwinch (); 
     881 
    880882    if ((tty_baudrate () < 9600) || mc_global.tty.slow_terminal) 
    881883        verbose = 0; 
    882884}