diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2020-09-17 00:55:17 +0300 |
---|---|---|
committer | Adam Jackson <ajax@nwnk.net> | 2020-09-24 17:33:22 +0000 |
commit | 5eb985e3531b69d3ddc4dc0d4b69b4280b1626f8 (patch) | |
tree | a9a646d3f3b20ea250f36d61f79f0e619f0ebe17 /mi | |
parent | a5f439dcd21b4fda093cb382bb1a758b434a1444 (diff) |
mi: Add a callback to notify driver about input event submission
This is useful for mock input drivers that control the server in
integration tests. Given that input submission happens on a different
thread than processing, it's otherwise impossible for the driver to
synchronize with the completion of the processing of submitted events.
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mi.h | 6 | ||||
-rw-r--r-- | mi/mieq.c | 18 |
2 files changed, 24 insertions, 0 deletions
@@ -205,6 +205,12 @@ extern _X_EXPORT void mieqProcessDeviceEvent(DeviceIntPtr /* dev */ , extern _X_EXPORT void mieqProcessInputEvents(void ); +extern _X_EXPORT void mieqAddCallbackOnDrained(CallbackProcPtr callback, + void *param); + +extern _X_EXPORT void mieqRemoveCallbackOnDrained(CallbackProcPtr callback, + void *param); + extern DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr /* sdev */ , InternalEvent * /* original */ , InternalEvent * /* copy */ @@ -87,6 +87,8 @@ typedef struct _EventQueue { static EventQueueRec miEventQueue; +static CallbackListPtr miCallbacksWhenDrained = NULL; + static size_t mieqNumEnqueued(EventQueuePtr eventQueue) { @@ -565,5 +567,21 @@ mieqProcessInputEvents(void) inProcessInputEvents = FALSE; + CallCallbacks(&miCallbacksWhenDrained, NULL); + + input_unlock(); +} + +void mieqAddCallbackOnDrained(CallbackProcPtr callback, void *param) +{ + input_lock(); + AddCallback(&miCallbacksWhenDrained, callback, param); + input_unlock(); +} + +void mieqRemoveCallbackOnDrained(CallbackProcPtr callback, void *param) +{ + input_lock(); + DeleteCallback(&miCallbacksWhenDrained, callback, param); input_unlock(); } |