Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 1454:6b98dc22946d
Add optional SIGWINCH handler (Markus Hennecke)
This patch from Markus Hennecke adds a configure option to
provide a SIGWINCH handler.
It is useful on some systems like OpenBSD where there is no
default handler for this signal.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 03 Apr 2008 21:20:56 +0200 |
parents | bb1cc8902d0e |
children | bec235cd28a8 |
comparison
equal
deleted
inserted
replaced
1453:f560710a6ad1 | 1454:6b98dc22946d |
---|---|
27 #include <ctype.h> | 27 #include <ctype.h> |
28 | 28 |
29 #include <config.h> | 29 #include <config.h> |
30 #include <locale.h> | 30 #include <locale.h> |
31 #include <assert.h> | 31 #include <assert.h> |
32 #ifdef USE_SIGWINCH | |
33 # include <sys/ioctl.h> | |
34 # include <termios.h> | |
35 # include <unistd.h> | |
36 #endif | |
32 | 37 |
33 #ifdef HAVE_LOCALCHARSET_H | 38 #ifdef HAVE_LOCALCHARSET_H |
34 # include <localcharset.h> | 39 # include <localcharset.h> |
35 #else | 40 #else |
36 # include <langinfo.h> | 41 # include <langinfo.h> |
3769 break; | 3774 break; |
3770 case 3: // Ctrl-C | 3775 case 3: // Ctrl-C |
3771 scr_handle_CtrlC(); | 3776 scr_handle_CtrlC(); |
3772 break; | 3777 break; |
3773 case KEY_RESIZE: | 3778 case KEY_RESIZE: |
3779 #ifdef USE_SIGWINCH | |
3780 { | |
3781 struct winsize size; | |
3782 if (ioctl(STDIN_FILENO, TIOCGWINSZ, &size) != -1) | |
3783 resizeterm(size.ws_row, size.ws_col); | |
3784 } | |
3774 scr_Resize(); | 3785 scr_Resize(); |
3786 process_command(mkcmdstr("screen_refresh"), TRUE); | |
3787 #else | |
3788 scr_Resize(); | |
3789 #endif | |
3775 break; | 3790 break; |
3776 default: | 3791 default: |
3777 display_char = TRUE; | 3792 display_char = TRUE; |
3778 } // switch | 3793 } // switch |
3779 | 3794 |