From: Andre Noll Date: Sat, 5 Mar 2016 20:39:47 +0000 (+0100) Subject: gui: Avoid bad terminal state with xterm. X-Git-Tag: v0.5.6~23^2~6 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=be46d3b63c855fe63ecc6feb7c4a2d3edab92307;hp=ec7552f87eb959b007bd0ed3642e5ccc2faa4d39 gui: Avoid bad terminal state with xterm. 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. --- diff --git a/gui.c b/gui.c index 6f688e0b..a2d4b5f6 100644 --- 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);