]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
gui: Dont catch SIGWINCH.
authorAndre Noll <maan@systemlinux.org>
Thu, 13 Feb 2014 18:59:49 +0000 (19:59 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 May 2014 13:48:55 +0000 (15:48 +0200)
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

diff --git a/gui.c b/gui.c
index db291c2583bc38da0634984bf80cb7bab96658c6..57ee8be5e9e9f2867f8c85ecdcce7aca2b4656a0 100644 (file)
--- 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);