diff --git a/include/QF/input/event.h b/include/QF/input/event.h index 1f960bda8..d16e66ac2 100644 --- a/include/QF/input/event.h +++ b/include/QF/input/event.h @@ -71,6 +71,11 @@ typedef enum { ie_button, } IE_event_type; +#define IE_broadcast_events (0 \ + | (1 << ie_add_device) \ + | (1 << ie_remove_device) \ + ) + typedef struct { IE_event_type type; uint64_t when; diff --git a/libs/input/in_event.c b/libs/input/in_event.c index aa302cf5b..b2aaf362c 100644 --- a/libs/input/in_event.c +++ b/libs/input/in_event.c @@ -54,6 +54,16 @@ static unsigned focus; int IE_Send_Event (const IE_event_t *event) { + if ((1 << event->type) & IE_broadcast_events) { + for (size_t i = 0; i < ie_handlers.size; i++) { + ie_reghandler_t *reg = &ie_handlers.a[i]; + if (reg->handler) { + reg->handler (event, reg->data); + } + } + return 1; + } + if (focus < ie_handlers.size && ie_handlers.a[focus].handler) { ie_reghandler_t *reg = &ie_handlers.a[focus]; return reg->handler (event, reg->data);