Display and control your Android device
Add utility to push an SDL event with data
Romain Vimontfe1fd557f7de
diff --git a/app/src/events.c b/app/src/events.cindex ca7e4008..5269bdbc 100644--- a/app/src/events.c+++ b/app/src/events.c@@ -6,9 +6,13 @@#include "util/thread.h"bool-sc_push_event_impl(uint32_t type, const char *name) {- SDL_Event event;- event.type = type;+sc_push_event_impl(uint32_t type, void *ptr, const char *name) {+ SDL_Event event = {+ .user = {+ .type = type,+ .data1 = ptr,+ }+ };bool ok = SDL_PushEvent(&event);if (!ok) {LOGE("Could not post %s event: %s", name, SDL_GetError());diff --git a/app/src/events.h b/app/src/events.hindex 567268ab..088863bd 100644--- a/app/src/events.h+++ b/app/src/events.h@@ -23,9 +23,10 @@ enum {};bool-sc_push_event_impl(uint32_t type, const char *name);+sc_push_event_impl(uint32_t type, void *ptr, const char *name);-#define sc_push_event(TYPE) sc_push_event_impl(TYPE, # TYPE)+#define sc_push_event(TYPE) sc_push_event_impl(TYPE, NULL, # TYPE)+#define sc_push_event_with_data(TYPE, PTR) sc_push_event_impl(TYPE, PTR, # TYPE)typedef void (*sc_runnable_fn)(void *userdata);