92
94
* aside from possibly delaying a filter() call until some terminals have been
95
static int filter_mode = FALSE;
97
static bool filter_mode = FALSE;
97
99
NCURSES_EXPORT(void)
100
103
T((T_CALLED("filter")));
101
104
filter_mode = TRUE;
108
#if NCURSES_EXT_FUNCS
110
* An extension, allowing the application to open a new screen without
111
* requiring it to also be filtered.
117
T((T_CALLED("nofilter")));
105
123
NCURSES_EXPORT(SCREEN *)
106
124
newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
109
128
int slk_format = _nc_slk_format;
113
133
T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp));
135
_nc_handle_sigwinch(0);
137
/* allow user to set maximum escape delay from the environment */
138
if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
115
142
/* this loads the capability entry, then sets LINES and COLS */
116
if (setupterm(name, fileno(ofp), &errret) == ERR)
119
/* implement filter mode */
124
cursor_down = parm_down_cursor = 0;
126
cursor_up = parm_up_cursor = 0;
129
cursor_home = carriage_return;
132
/* If we must simulate soft labels, grab off the line to be used.
133
We assume that we must simulate, if it is none of the standard
134
formats (4-4 or 3-2-3) for which there may be some hardware
136
if (num_labels <= 0 || !SLK_STDFMT(slk_format))
138
if (ERR == _nc_ripoffline(-SLK_LINES(slk_format),
143
if (setupterm(name, fileno(ofp), &errret) == ERR) {
147
* This actually allocates the screen structure, and saves the original
152
if (_nc_setupscreen(LINES, COLS, ofp, filter_mode, slk_format) == ERR) {
153
_nc_set_screen(current);
156
/* if the terminal type has real soft labels, set those up */
157
if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format))
158
_nc_slk_initialize(stdscr, COLS);
160
SP->_ifd = fileno(ifp);
161
typeahead(fileno(ifp));
163
SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 &&
164
!(cur_term->Ottyb.c_iflag & ISTRIP));
166
SP->_use_meta = FALSE;
171
* Check whether we can optimize scrolling under dumb terminals in
172
* case we do not have any of these capabilities, scrolling
173
* optimization will be useless.
175
SP->_scrolling = ((scroll_forward && scroll_reverse) ||
183
baudrate(); /* sets a field in the SP structure */
188
* Check for mismatched graphic-rendition capabilities. Most SVr4
189
* terminfo trees contain entries that have rmul or rmso equated to
190
* sgr0 (Solaris curses copes with those entries). We do this only
191
* for curses, since many termcap applications assume that
192
* smso/rmso and smul/rmul are paired, and will not function
193
* properly if we remove rmso or rmul. Curses applications
194
* shouldn't be looking at this detail.
196
#define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode))
197
SP->_use_rmso = SGR0_TEST(exit_standout_mode);
198
SP->_use_rmul = SGR0_TEST(exit_underline_mode);
200
/* compute movement costs so we can do better move optimization */
203
/* initialize terminal to a sane state */
206
/* Initialize the terminal line settings. */
209
_nc_signal_handler(TRUE);
142
/* this actually allocates the screen structure, and saves the
143
* original terminal settings.
147
if (_nc_setupscreen(LINES, COLS, ofp) == ERR) {
148
_nc_set_screen(current);
152
/* if the terminal type has real soft labels, set those up */
153
if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format))
154
_nc_slk_initialize(stdscr, COLS);
156
SP->_ifd = fileno(ifp);
157
typeahead(fileno(ifp));
159
SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 &&
160
!(cur_term->Ottyb.c_iflag & ISTRIP));
162
SP->_use_meta = FALSE;
166
/* Check whether we can optimize scrolling under dumb terminals in case
167
* we do not have any of these capabilities, scrolling optimization
170
SP->_scrolling = ((scroll_forward && scroll_reverse) ||
171
((parm_rindex || parm_insert_line || insert_line) &&
172
(parm_index || parm_delete_line || delete_line)));
174
baudrate(); /* sets a field in the SP structure */
179
* Check for mismatched graphic-rendition capabilities. Most SVr4
180
* terminfo trees contain entries that have rmul or rmso equated to
181
* sgr0 (Solaris curses copes with those entries). We do this only for
182
* curses, since many termcap applications assume that smso/rmso and
183
* smul/rmul are paired, and will not function properly if we remove
184
* rmso or rmul. Curses applications shouldn't be looking at this
187
#define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode))
188
SP->_use_rmso = SGR0_TEST(exit_standout_mode);
189
SP->_use_rmul = SGR0_TEST(exit_underline_mode);
191
/* compute movement costs so we can do better move optimization */
194
/* initialize terminal to a sane state */
197
/* Initialize the terminal line settings. */
200
_nc_signal_handler(TRUE);
204
* Pretend we received a SIGWINCH, just in case we're starting up in a
205
* terminal that cannot initialize its size properly (Debian #265631).
207
SP->_sig_winch = TRUE;
214
_nc_handle_sigwinch(1);