Create event_command callback

This commit is contained in:
twinaphex 2015-04-13 13:46:48 +02:00
parent 62960177fe
commit a1e2228477
4 changed files with 34 additions and 0 deletions

View File

@ -90,11 +90,22 @@ static void *ui_companion_cocoatouch_init(void)
return handle;
}
static void ui_companion_cocoatouch_event_command(void *data, unsigned cmd)
{
ui_companion_cocoatouch_t *handle = (ui_companion_cocoatouch_t*)data;
if (!handle)
return;
event_command(cmd);
}
const ui_companion_driver_t ui_companion_cocoatouch = {
ui_companion_cocoatouch_init,
ui_companion_cocoatouch_deinit,
ui_companion_cocoatouch_iterate,
ui_companion_cocoatouch_toggle,
ui_companion_cocoatouch_event_command,
ui_companion_cocoatouch_notify_content_loaded,
"cocoatouch",
};

View File

@ -63,11 +63,18 @@ static void ui_companion_null_toggle(void *data)
(void)data;
}
static void ui_companion_null_event_command(void *data, unsigned cmd)
{
(void)data;
(void)cmd;
}
const ui_companion_driver_t ui_companion_null = {
ui_companion_null_init,
ui_companion_null_deinit,
ui_companion_null_iterate,
ui_companion_null_toggle,
ui_companion_null_event_command,
ui_companion_null_notify_content_loaded,
"null",
};

View File

@ -102,11 +102,24 @@ static void ui_companion_qt_toggle(void *data)
ui_companion_qt_init();
}
static void ui_companion_qt_event_command(void *data, unsigned cmd)
{
ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
if (!handle)
return;
slock_lock(handle->lock);
event_command(cmd);
slock_unlock(handle->lock);
}
const ui_companion_driver_t ui_companion_qt = {
ui_companion_qt_init,
ui_companion_qt_deinit,
ui_companion_qt_iterate,
ui_companion_qt_toggle,
ui_companion_qt_event_command,
ui_companion_qt_notify_content_loaded,
"qt",
};

View File

@ -24,6 +24,8 @@
#include "../config.h"
#endif
#include "../command_event.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -34,6 +36,7 @@ typedef struct ui_companion_driver
void (*deinit)(void *data);
int (*iterate)(void *data, unsigned action);
void (*toggle)(void *data);
void (*event_command)(void *data, unsigned action);
void (*notify_content_loaded)(void *data);
const char *ident;