Make process_text() optional

Not all key processors support text injection (HID keyboard does not
support it).

Instead of providing a dummy op function, set it to NULL and check on
the caller side before calling it.
This commit is contained in:
Romain Vimont
2021-12-30 15:03:39 +01:00
parent 63e29b1782
commit bc674721dc
3 changed files with 17 additions and 11 deletions

View File

@@ -29,17 +29,24 @@ struct sc_key_processor {
struct sc_key_processor_ops {
/**
* Process the keyboard event
* Process a keyboard event
*
* The `sequence` number (if different from `SC_SEQUENCE_INVALID`) indicates
* the acknowledgement number to wait for before injecting this event.
* This allows to ensure that the device clipboard is set before injecting
* Ctrl+v on the device.
*
* This function is mandatory.
*/
void
(*process_key)(struct sc_key_processor *kp,
const struct sc_key_event *event, uint64_t ack_to_wait);
/**
* Process an input text
*
* This function is optional.
*/
void
(*process_text)(struct sc_key_processor *kp,
const struct sc_text_event *event);