aboutsummaryrefslogtreecommitdiff
path: root/termkey_new.3
blob: 4a7f7740056d93fc49dc98b9da513e6aa3116450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.TH TERMKEY_NEW 3
.SH NAME
termkey_new, termkey_destroy \- create or destroy new termkey instance
.SH SYNOPSIS
.nf
.B #include <termkey.h>
.sp
.BI "TERMKEY_CHECK_VERSION;"
.br
.BI "TermKey *termkey_new(int " fd ", int " flags );
.br
.BI "void termkey_destroy(TermKey *" tk );
.fi
.sp
Link with \fI\-ltermkey\fP.
.SH DESCRIPTION
\fBtermkey_new\fP() creates a new termkey instance connected to the file handle opened by \fIfd\fP using the \fIflags\fP. The \fBTermKey\fP structure should be considered opaque; its contents are not intended for use outside of the library.
.PP
\fBtermkey_destroy\fP() destroys the given instance and releases any resources controlled by it. It will not close the underlying filehandle given as the \fIfd\fP argument to \fBtermkey_new\fP().
.PP
The following values may be given as the \fIflags\fP bitmask:
.TP
.B TERMKEY_FLAG_NOINTERPRET
Do not attempt to interpret \fBC0\fP codes into keysyms. Instead report them as plain "Ctrl-letter" events.
.TP
.B TERMKEY_FLAG_CONVERTKP
Convert xterm's alternative keypad symbols into the plain
.SM ASCII
codes they would represent.
.TP
.B TERMKEY_FLAG_RAW
Ignore locale settings; do not attempt to recombine UTF-8 sequences. Instead report only raw values.
.TP
.B TERMKEY_FLAG_UTF8
Ignore locale settings; force UTF-8 recombining on. This flag overrides \fBTERMKEY_FLAG_RAW\fP.
.TP
.B TERMKEY_FLAG_NOTERMIOS
Even if the terminal file descriptor \fIfd\fP represents a
.SM TTY
device, do not call the \fBtcsetattr\fP() \fBtermios\fP function on it to set it to canonical input mode.
.PP
When the constructor is invoked, it attempts to detect if the current locale is UTF-8 aware or not, and sets either the \fBTERMKEY_FLAG_UTF8\fP or \fBTERMKEY_FLAG_RAW\fP flag. One of these two bits will always be in effect. The current flags in effect can be obtained by \fBtermkey_get_flags\fP().
.SH VERSION CHECK MACRO
Before calling any functions in the \fItermkey\fP library, an application should use the \fBTERMKEY_CHECK_VERSION\fP macro to check that the loaded version of the library is compatible with the version it was compiled against. This should be done early on, ideally just after entering its \fBmain()\fP function.
.SH "RETURN VALUE"
If successful, \fBtermkey_new\fP() returns a pointer to the new instance. On failure, \fBNULL\fP is returned. \fBtermkey_destroy\fP() returns no value.
.SH "SEE ALSO"
.BR termkey_waitkey (3),
.BR termkey_advisereadable (3),
.BR termkey_getkey (3),
.BR termkey_get_flags (3),
.BR termkey_get_fd (3)