termkey_keycmp() compares two key structures and applies a total ordering, returning a value that is
negative, zero, or positive, to indicate if the given structures are increasing, identical, or
decreasing. Before comparison, copies of both referenced structures are taken, and canonicalised
according to the rules for termkey_canonicalise(3).
Two structures of differing type are ordered TERMKEY_TYPE_UNICODE, TERMKEY_TYPE_KEYSYM,
TERMKEY_TYPE_FUNCTION, TERMKEY_TYPE_MOUSE. 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.