diff mcabber/mcabber/main.c @ 2231:387cea2a1a81

Fix resizing with --enable-sigwinch
author Mikael Berthe <mikael@lilotux.net>
date Sun, 15 Nov 2015 17:03:41 +0100
parents 1afa40f1d80d
children f5402d705f67
line wrap: on
line diff
--- a/mcabber/mcabber/main.c	Wed Nov 11 10:06:46 2015 +0100
+++ b/mcabber/mcabber/main.c	Sun Nov 15 17:03:41 2015 +0100
@@ -63,7 +63,12 @@
 # define WAIT_ANY -1
 #endif
 
-static unsigned int terminate_ui;
+#ifdef USE_SIGWINCH
+void sigwinch_resize(void);
+static bool sigwinch;
+#endif
+
+static bool terminate_ui;
 GMainContext *main_context;
 
 static struct termios *backup_termios;
@@ -123,8 +128,7 @@
     mcabber_terminate("Killed by SIGHUP");
 #ifdef USE_SIGWINCH
   } else if (signum == SIGWINCH) {
-    if (scr_curses_status())
-      ungetch(KEY_RESIZE);
+    sigwinch = TRUE;
 #endif
   } else {
     scr_LogPrint(LPRINT_LOGNORM, "Caught signal: %d", signum);
@@ -555,6 +559,12 @@
     while(!terminate_ui) {
       if (g_main_context_iteration(main_context, TRUE) == FALSE)
         keyboard_activity();
+#ifdef USE_SIGWINCH
+      if (sigwinch) {
+        sigwinch_resize();
+        sigwinch = FALSE;
+      }
+#endif
       if (update_roster)
         scr_draw_roster();
       scr_do_update();