1TERMKEY_KEYCMP(3) Library Functions Manual TERMKEY_KEYCMP(3)
2
3
4
6 termkey_keycmp - compare two key events
7
9 #include <termkey.h>
10
11 int termkey_keycmp(TermKey *tk, const TermKeyKey *key1,
12 const TermKeyKey *key2);
13
14 Link with -ltermkey.
15
17 termkey_keycmp() compares two key structures and applies a total order‐
18 ing, returning a value that is negative, zero, or positive, to indicate
19 if the given structures are increasing, identical, or decreasing.
20 Before comparison, copies of both referenced structures are taken, and
21 canonicalised according to the rules for termkey_canonicalise(3).
22
23 Two structures of differing type are ordered TERMKEY_TYPE_UNICODE,
24 TERMKEY_TYPE_KEYSYM, TERMKEY_TYPE_FUNCTION, TERMKEY_TYPE_MOUSE. Unicode
25 structures are ordered by codepoint, keysym structures are ordered by
26 keysym number, function structures are ordered by function key number,
27 and mouse structures are ordered opaquely by an unspecified but consis‐
28 tent ordering. Within these values, keys different in modifier bits are
29 ordered by the modifiers.
30
32 termkey_keycmp() returns an integer greater than, equal to, or less
33 than zero to indicate the relation between the two given key struc‐
34 tures.
35
37 termkey_strpkey(3), termkey_canonicalise(3), termkey(7)
38
39
40
41 TERMKEY_KEYCMP(3)