2 * Copyright (c) 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid
[] = "@(#)tk_term.c 8.12 (Berkeley) 10/13/96";
16 #include <sys/types.h>
17 #include <sys/queue.h>
19 #include <bitstring.h>
29 #include "../common/common.h"
34 * Initialize the terminal special keys.
36 * PUBLIC: int tk_term_init __P((SCR *));
45 * Rework any function key mappings that were set before the
46 * screen was initialized.
48 for (qp
= sp
->gp
->seqq
.lh_first
; qp
!= NULL
; qp
= qp
->q
.le_next
)
49 if (F_ISSET(qp
, SEQ_FUNCMAP
))
50 (void)tk_fmap(sp
, qp
->stype
,
51 qp
->input
, qp
->ilen
, qp
->output
, qp
->olen
);
57 * End the special keys defined by the termcap/terminfo entry.
59 * PUBLIC: int tk_term_end __P((GS *));
67 /* Delete screen specific mappings. */
68 for (qp
= gp
->seqq
.lh_first
; qp
!= NULL
; qp
= nqp
) {
70 if (F_ISSET(qp
, SEQ_SCREEN
))
80 * PUBLIC: int tk_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
83 tk_fmap(sp
, stype
, from
, flen
, to
, tlen
)
91 /* Bind a Tk/Tcl function key to a string sequence. */
97 * Curses screen specific "option changed" routine.
99 * PUBLIC: int tk_optchange __P((SCR *, int, char *, u_long *));
102 tk_optchange(sp
, opt
, str
, valp
)
112 * Changing the columns or lines require that we restart
115 F_SET(sp
->gp
, G_SRESTART
);
116 F_CLR(sp
, SC_SCR_EX
| SC_SCR_VI
);
119 msgq(sp
, M_ERR
, "The screen type may not be changed");
127 * Return the window size.
129 * PUBLIC: int tk_ssize __P((SCR *, int, size_t *, size_t *, int *));
132 tk_ssize(sp
, sigwinch
, rowp
, colp
, changedp
)
140 tkp
= GTKP(__global_list
);
141 (void)Tcl_Eval(tkp
->interp
, "tk_ssize");
144 * SunOS systems deliver SIGWINCH when windows are uncovered
145 * as well as when they change size. In addition, we call
146 * here when continuing after being suspended since the window
147 * may have changed size. Since we don't want to background
148 * all of the screens just because the window was uncovered,
149 * ignore the signal if there's no change.
154 if (sigwinch
&& sp
!= NULL
&&
155 tkp
->tk_ssize_row
== O_VAL(sp
, O_LINES
) &&
156 tkp
->tk_ssize_col
== O_VAL(sp
, O_COLUMNS
)) {
157 if (changedp
!= NULL
)
163 *rowp
= tkp
->tk_ssize_row
;
165 *colp
= tkp
->tk_ssize_col
;
166 if (changedp
!= NULL
)