From be46d3b63c855fe63ecc6feb7c4a2d3edab92307 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 5 Mar 2016 21:39:47 +0100 Subject: [PATCH 1/1] 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. --- gui.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.39.2