]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
gui: Avoid bad terminal state with xterm.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 5 Mar 2016 20:39:47 +0000 (21:39 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 13 Mar 2016 17:19:00 +0000 (18:19 +0100)
If para_gui is signalled in external mode, and the running program
has set the mouse mask to receive mouse events, mouse buttons
(copy and paste) might not work after para_gui exits. This has
been observed at least with xterm and aumix as the external program.

Setting an all-one mask seems to cure the problem.

gui.c

diff --git a/gui.c b/gui.c
index 6f688e0be6832c39dbcb5d620b2b6dfac96510c1..a2d4b5f6c7611914b566128f509bea80caf6fe76 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -509,6 +509,10 @@ __noreturn __printf_2_3 static void die(int exit_code, const char* fmt, ...)
 {
        va_list argp;
 
+       /* mousemask() exists only in ncurses */
+#ifdef NCURSES_MOUSE_VERSION
+       mousemask(~(mmask_t)0, NULL); /* Avoid bad terminal state with xterm. */
+#endif
        shutdown_curses();
        va_start(argp, fmt);
        vfprintf(stderr, fmt, argp);