Mercurial > mxe-octave
comparison src/readline-1-sigwinch.patch @ 2980:2cf09b449d88
readline patches for windows from goffioul
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 18 Apr 2013 02:04:36 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2978:9d0ba0c088f5 | 2980:2cf09b449d88 |
---|---|
1 diff -uNr a/readline.c b/readline.c | |
2 --- a/readline.c 2010-07-25 17:07:40.000000000 -0400 | |
3 +++ b/readline.c 2013-04-17 16:11:52.932653458 -0400 | |
4 @@ -970,6 +970,11 @@ | |
5 rl_initialized++; | |
6 RL_SETSTATE(RL_STATE_INITIALIZED); | |
7 } | |
8 +#if defined (__MINGW32__) | |
9 + else | |
10 + /* In case the console window has been resized outside of readline */ | |
11 + rl_reset_screen_size (); | |
12 +#endif | |
13 | |
14 /* Initalize the current line information. */ | |
15 _rl_init_line_state (); | |
16 diff -uNr a/signals.c b/signals.c | |
17 --- a/signals.c 2011-02-11 10:53:33.000000000 -0500 | |
18 +++ b/signals.c 2013-04-17 16:07:57.476121748 -0400 | |
19 @@ -46,6 +46,11 @@ | |
20 | |
21 #include "rlprivate.h" | |
22 | |
23 +#if defined (__MINGW32__) | |
24 +# define WIN32_LEAN_AND_MEAN | |
25 +# include <windows.h> | |
26 +#endif | |
27 + | |
28 #if defined (HANDLE_SIGNALS) | |
29 | |
30 #if !defined (RETSIGTYPE) | |
31 @@ -91,7 +96,7 @@ | |
32 int rl_catch_signals = 1; | |
33 | |
34 /* If non-zero, readline will install a signal handler for SIGWINCH. */ | |
35 -#ifdef SIGWINCH | |
36 +#if defined (SIGWINCH) || defined (__MINGW32__) | |
37 int rl_catch_sigwinch = 1; | |
38 #else | |
39 int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */ | |
40 @@ -422,6 +427,21 @@ | |
41 } | |
42 #endif /* SIGWINCH */ | |
43 | |
44 +#if defined (__MINGW32__) | |
45 + if (rl_catch_sigwinch && sigwinch_set_flag == 0) | |
46 + { | |
47 + DWORD mode; | |
48 + HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE); | |
49 + | |
50 + if (GetConsoleMode (hStdIn, &mode)) | |
51 + { | |
52 + mode |= ENABLE_WINDOW_INPUT; | |
53 + if (SetConsoleMode (hStdIn, mode)) | |
54 + sigwinch_set_flag = 1; | |
55 + } | |
56 + } | |
57 +#endif | |
58 + | |
59 return 0; | |
60 } | |
61 | |
62 @@ -467,6 +487,21 @@ | |
63 } | |
64 #endif | |
65 | |
66 +#if defined (__MINGW32__) | |
67 + if (rl_catch_sigwinch && sigwinch_set_flag == 1) | |
68 + { | |
69 + DWORD mode; | |
70 + HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE); | |
71 + | |
72 + if (GetConsoleMode (hStdIn, &mode)) | |
73 + { | |
74 + mode &= ~ENABLE_WINDOW_INPUT; | |
75 + if (SetConsoleMode (hStdIn, mode)) | |
76 + sigwinch_set_flag = 0; | |
77 + } | |
78 + } | |
79 +#endif | |
80 + | |
81 return 0; | |
82 } | |
83 |