Mercurial > mxe-octave
view src/readline-1-sigwinch.patch @ 3925:7ee26841a98b
of-geometry: update to v2.0.0
* src/of-geometry.mk: update version, checksum, pkg dir
* build_packages.m: update geometry version to 2.0.0
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 03 May 2015 15:10:38 -0400 |
parents | 2cf09b449d88 |
children |
line wrap: on
line source
diff -uNr a/readline.c b/readline.c --- a/readline.c 2010-07-25 17:07:40.000000000 -0400 +++ b/readline.c 2013-04-17 16:11:52.932653458 -0400 @@ -970,6 +970,11 @@ rl_initialized++; RL_SETSTATE(RL_STATE_INITIALIZED); } +#if defined (__MINGW32__) + else + /* In case the console window has been resized outside of readline */ + rl_reset_screen_size (); +#endif /* Initalize the current line information. */ _rl_init_line_state (); diff -uNr a/signals.c b/signals.c --- a/signals.c 2011-02-11 10:53:33.000000000 -0500 +++ b/signals.c 2013-04-17 16:07:57.476121748 -0400 @@ -46,6 +46,11 @@ #include "rlprivate.h" +#if defined (__MINGW32__) +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + #if defined (HANDLE_SIGNALS) #if !defined (RETSIGTYPE) @@ -91,7 +96,7 @@ int rl_catch_signals = 1; /* If non-zero, readline will install a signal handler for SIGWINCH. */ -#ifdef SIGWINCH +#if defined (SIGWINCH) || defined (__MINGW32__) int rl_catch_sigwinch = 1; #else int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */ @@ -422,6 +427,21 @@ } #endif /* SIGWINCH */ +#if defined (__MINGW32__) + if (rl_catch_sigwinch && sigwinch_set_flag == 0) + { + DWORD mode; + HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE); + + if (GetConsoleMode (hStdIn, &mode)) + { + mode |= ENABLE_WINDOW_INPUT; + if (SetConsoleMode (hStdIn, mode)) + sigwinch_set_flag = 1; + } + } +#endif + return 0; } @@ -467,6 +487,21 @@ } #endif +#if defined (__MINGW32__) + if (rl_catch_sigwinch && sigwinch_set_flag == 1) + { + DWORD mode; + HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE); + + if (GetConsoleMode (hStdIn, &mode)) + { + mode &= ~ENABLE_WINDOW_INPUT; + if (SetConsoleMode (hStdIn, mode)) + sigwinch_set_flag = 0; + } + } +#endif + return 0; }