aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 16:34:47 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 16:34:47 +0000
commit0be6f18019e1a5f5765c2061f7d69436e5fdec57 (patch)
treee76d2840e4d04b851b8afdd2d019899b706bedda /man
parentc00f6cd3c63e01c84220b607eccf5a2ba2df8f63 (diff)
downloadtermo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.tar.gz
termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.tar.xz
termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.zip
Handle ANSI and DEC mode report CSIs
Diffstat (limited to 'man')
-rw-r--r--man/termkey.75
-rw-r--r--man/termkey_interpret_modereport.326
2 files changed, 31 insertions, 0 deletions
diff --git a/man/termkey.7 b/man/termkey.7
index 2313fb5..01ad69c 100644
--- a/man/termkey.7
+++ b/man/termkey.7
@@ -53,6 +53,9 @@ a mouse button press, release, or movement. The \fIcode.mouse\fP array should be
.B TERMKEY_TYPE_POSITION
a cursor position report. The structure should be considered opaque; \fBtermkey_interpret_position\fP(3) may be used to interpret it.
.TP
+.B TERMKEY_TYPE_MODEREPORT
+an ANSI or DEC mode value report. The structure should be considered opaque; \fBtermkey_interpret_modereport\fP(3) may be used to interpret it.
+.TP
.B TERMKEY_TYPE_UNKNOWN_CSI
an unrecognised CSI sequence. The structure should be considered opaque; \fBtermkey_interpret_csi\fP(3) may be used to interpret it.
.PP
@@ -133,6 +136,8 @@ protocol (\f(CWCSI M\fP followed by three bytes),
encoding (\f(CWCSI < ... M\fP, as requested by \f(CWCSI ? 1006 h\fP), and rxvt encoding (\f(CWCSI ... M\fP, as requested by \f(CWCSI ? 1015 h\fP). Which encoding is in use is inferred automatically by \fBtermkey\fP, and does not need to be specified explicitly.
.SS Position Events
The \fBTERMKEY_TYPE_POSITION\fP event type indicates a cursor position report. This is typically sent by a terminal in response to the Report Cursor Position command (\f(CWCSI ? 6 n\fP). The event bytes are opaque, but can be obtained by calling \fBtermkey_interpret_position\fP(3) passing the event structure and pointers to integers to store the result in. Note that only a DEC CPR sequence (\f(CWCSI ? R\fP) is recognised, and not the non-DEC prefixed \f(CWCSI R\fP because the latter could be interpreted as the \f(CWF3\fP function key instead.
+.SS Mode Reports
+The \fBTERMKEY_TYPE_MODEREPORT\fP event type indicates an ANSI or DEC mode report. This is typically sent by a terminal in response to the Request Mode command (\f(CWCSI $p\fP or \f(CWCSI ? $p\fP). The event bytes are opaque, but can be obtained by calling \fBtermkey_interpret_modereport\fP(3) passing the event structure and pointers to integers to store the result in.
.SS Unrecognised CSIs
The \fBTERMKEY_TYPE_UNKNOWN_CSI\fP event type indicates a CSI sequence that the \fBtermkey\fP does not recognise. It will have been extracted from the stream, but is available to the application to inspect by calling \fBtermkey_interpret_csi\fP(3). It is important that if the application wishes to inspect this sequence it is done immediately, before any other IO operations on the \fBtermkey\fP instance (specifically, before calling \fBtermkey_waitkey\fP() or \fBtermkey_getkey\fP() again), otherwise the buffer space consumed by the sequence will be overwritten.
.SH "SEE ALSO"
diff --git a/man/termkey_interpret_modereport.3 b/man/termkey_interpret_modereport.3
new file mode 100644
index 0000000..d778655
--- /dev/null
+++ b/man/termkey_interpret_modereport.3
@@ -0,0 +1,26 @@
+.TH TERMKEY_INTERPRET_MODEREPORT 3
+.SH NAME
+termkey_interpret_modereport \- interpret opaque mode report data
+.SH SYNOPSIS
+.nf
+.B #include <termkey.h>
+.sp
+.BI "TermKeyResult termkey_interpret_modereport(TermKey *" tk ", const TermKeyKey *" key ", "
+.BI " int *" initial ", int *" mode ", int *" value );
+.fi
+.sp
+Link with \fI-ltermkey\fP.
+.SH DESCRIPTION
+\fBtermkey_interpret_modereport\fP() fills in variables in the passed pointers according to the mode report event found in \fIkey\fP. It should be called if \fBtermkey_getkey\fP(3) or similar have returned a key event with the type of \fBTERMKEY_TYPE_MODEREPORT\fP.
+.PP
+Any pointer may instead be given as \fBNULL\fP to not return that value.
+.PP
+The \fIinitial\fP variable will be filled with 0 for an ANSI mode report, or \f(CW'?'\fP for a DEC mode report. The \fImode\fP variable will be filled with the number of the mode, and \fIvalue\fP will be filled with the value from the report.
+.SH "RETURN VALUE"
+If passed a \fIkey\fP event of the type \fBTERMKEY_TYPE_MODEREPORT\fP, this function will return \fBTERMKEY_RES_KEY\fP and will affect the variables whose pointers were passed in, as described above.
+.PP
+For other event types it will return \fBTERMKEY_RES_NONE\fP, and its effects on any variables whose pointers were passed in, are undefined.
+.SH "SEE ALSO"
+.BR termkey_waitkey (3),
+.BR termkey_getkey (3),
+.BR termkey (7)