From ad7d31ead8ff9c34bb63172754d3e7d15d803bde Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Sat, 2 Apr 2011 15:07:30 +0100 Subject: Provide termkey_keycmp() for sorting purposes --- termkey_keycmp.3 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 termkey_keycmp.3 (limited to 'termkey_keycmp.3') diff --git a/termkey_keycmp.3 b/termkey_keycmp.3 new file mode 100644 index 0000000..519752b --- /dev/null +++ b/termkey_keycmp.3 @@ -0,0 +1,24 @@ +.TH TERMKEY_KEYCMP 3 +.SH NAME +termkey_keycmp \- compare two key events +.SH SYNOPSIS +.nf +.B #include +.sp +.BI "int termkey_keycmp(TermKey *" tk ", const TermKeyKey *" key1 ", +.BI " const TermKeyKey *" key2 ); +.fi +.sp +Link with \fI-ltermkey\fP. +.SH DESCRIPTION +\fBtermkey_keycmp\fP compares two key structures and applies a total ordering, returning a value that is positive, zero, or negative, to indicate if the given structures are increasing, identical, or decreasing. +.PP +Two structures of differing type are ordered \fBTERMKEY_TYPE_UNICODE\fP, \fBTERMKEY_TYPE_KEYSYM\fP, \fBTERMKEY_TYPE_FUNCTION\fP, \fBTERMKEY_TYPE_MOUSE\fP. Unicode structures are ordered by codepoint, keysym structures are ordered by keysym number, function structures are ordered by function key number, and mouse structures are ordered opaquely by an unspecified but consistent ordering. Within these values, keys different in modifier bits are ordered by the modifiers. +.SH "RETURN VALUE" +\fBtermkey_keycmp\fP() returns an integer greater than, equal to, or less than zero to indicate the relation between the two given key structures. +.SH NOTES +This function does not perform any canonicalisation of the key structures, and performs a simple comparison of the fields in the structures. In particular, it will not consider as equal \fBTERMKEY_TYPE_UNICODE\fP containing the Space codepoint (U+0020) vs. \fBTERMKEY_TYPE_KEYSYM\fP containing \fBTERMKEY_SYM_SPACE\fP. +.SH "SEE ALSO" +.BR termkey_new (3), +.BR termkey_getkey (3) +.BR termkey_strpkey (3) -- cgit v1.2.3-54-g00ecf