diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-20 08:44:46 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-21 11:05:49 -0300 |
commit | 77cc078c41c4348a3649cc366a262e6fab43980b (patch) | |
tree | 80e6df8ed06db3388beeff54f27e2c1beef511cd /src/nvim/os/event_defs.h | |
parent | cf6f60ce4dc376570e8d71facea76299ca951604 (diff) | |
download | rneovim-77cc078c41c4348a3649cc366a262e6fab43980b.tar.gz rneovim-77cc078c41c4348a3649cc366a262e6fab43980b.tar.bz2 rneovim-77cc078c41c4348a3649cc366a262e6fab43980b.zip |
event: Remove EventType enum and pass a callback to `event_push`
This approach is more flexible because we don't need to support a fixed set of
"event types", any module can push events to be handled in main loop by simply
passing a callback to the Event structure.
Diffstat (limited to 'src/nvim/os/event_defs.h')
-rw-r--r-- | src/nvim/os/event_defs.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nvim/os/event_defs.h b/src/nvim/os/event_defs.h index dbee3e2ba7..553d4e3125 100644 --- a/src/nvim/os/event_defs.h +++ b/src/nvim/os/event_defs.h @@ -7,16 +7,12 @@ #include "nvim/os/rstream_defs.h" typedef void * EventSource; +typedef struct event Event; +typedef void (*event_handler)(Event event); -typedef enum { - kEventSignal, - kEventRStreamData, - kEventJobExit -} EventType; - -typedef struct { +struct event { EventSource source; - EventType type; + event_handler handler; union { int signum; struct { @@ -25,6 +21,6 @@ typedef struct { } rstream; Job *job; } data; -} Event; +}; #endif // NVIM_OS_EVENT_DEFS_H |