diff 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
line wrap: on
line diff
--- a/mcabber/src/screen.c	Wed Apr 02 22:31:23 2008 +0200
+++ b/mcabber/src/screen.c	Thu Apr 03 21:20:56 2008 +0200
@@ -29,6 +29,11 @@
 #include <config.h>
 #include <locale.h>
 #include <assert.h>
+#ifdef USE_SIGWINCH
+# include <sys/ioctl.h>
+# include <termios.h>
+# include <unistd.h>
+#endif
 
 #ifdef HAVE_LOCALCHARSET_H
 # include <localcharset.h>
@@ -3771,7 +3776,17 @@
         scr_handle_CtrlC();
         break;
     case KEY_RESIZE:
+#ifdef USE_SIGWINCH
+        {
+            struct winsize size;
+            if (ioctl(STDIN_FILENO, TIOCGWINSZ, &size) != -1)
+              resizeterm(size.ws_row, size.ws_col);
+        }
         scr_Resize();
+        process_command(mkcmdstr("screen_refresh"), TRUE);
+#else
+        scr_Resize();
+#endif
         break;
     default:
         display_char = TRUE;