From 9775f534cc971999cec266cb0ea526e254559d87 Mon Sep 17 00:00:00 2001
From: Andre Noll <maan@systemlinux.org>
Date: Thu, 13 Feb 2014 19:59:49 +0100
Subject: [PATCH] gui: Dont catch SIGWINCH.

This is unnecessary since the curses library generates a KEY_RESIZE
event on SIGWINCH anyway. Hence window change events can be handled
as well in the normal input processing function. This allows to remove
the SIGWINCH part of the signal handling code.

Another advantage of handling SIGWINCH in the same way as normal
input events is that it is easier to propagate the event. This will
turn out to be useful for the upcoming gui menu changes.
---
 gui.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gui.c b/gui.c
index db291c25..57ee8be5 100644
--- a/gui.c
+++ b/gui.c
@@ -907,13 +907,6 @@ static int signal_post_select(struct sched *s, __a_unused struct task *t)
 	case SIGTERM:
 		die(EXIT_FAILURE, "only the good die young (caught SIGTERM)\n");
 		return 1;
-	case SIGWINCH:
-		if (curses_active()) {
-			shutdown_curses();
-			init_curses();
-			redraw_bot_win();
-		}
-		return 1;
 	case SIGINT:
 		PARA_WARNING_LOG("caught SIGINT, reset\n");
 		/* Nothing to do. SIGINT killed our child which gets noticed
@@ -1120,13 +1113,19 @@ static int input_post_select(__a_unused struct sched *s, __a_unused struct task
 			in.needs_update = sep.needs_update = false;
 	}
 	ret = wgetch(top.win);
-	if (ret == ERR || ret == KEY_RESIZE)
+	if (ret == ERR)
 		return 0;
-	if (exs == EXEC_IDLE) {
-		handle_command(ret);
+	if (ret == KEY_RESIZE) {
+		if (curses_active()) {
+			shutdown_curses();
+			init_curses();
+			redraw_bot_win();
+		}
 		return 0;
 	}
-	if (exec_pid != 0)
+	if (exs == EXEC_IDLE)
+		handle_command(ret);
+	else if (exec_pid > 0)
 		kill(exec_pid, SIGTERM);
 	return 0;
 }
@@ -1446,7 +1445,6 @@ static int setup_tasks_and_schedule(void)
 	para_install_sighandler(SIGINT);
 	para_install_sighandler(SIGTERM);
 	para_install_sighandler(SIGCHLD);
-	para_install_sighandler(SIGWINCH);
 	para_install_sighandler(SIGUSR1);
 
 	register_task(&sched, &exec_task.task);
-- 
2.39.5