API change -- Remove first ctx argument and add event mask to callback

There really does not exist a good reason for us sending a `uev_ctx_t *`
pointer as the first argument to event callbacks.  If the callback needs
to reference the context, it can find the ctx pointer in the `uev_t *w`.

This patch removes the first argument from all callbacks and also fixes
a slight bug in that the event loop never returned the actual event that
triggered the callback!

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-06-09 13:10:20 +02:00
1 parent 9e7f6865fc
commit 1f9558059a
6 files changed
+30 -24

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ struct js_event {
uint8_t number; /* axis/button number */
} e;
static void joystick_cb(uev_ctx_t *UNUSED(ctx), uev_t *w, void *UNUSED(arg), int UNUSED(events))
static void joystick_cb(uev_t *w, void *UNUSED(arg), int UNUSED(events))
{
if (read (w->fd, &e, sizeof(e)) < 0)
errx(errno, "Failed reading joystick event");