mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Add utility to push an SDL event with data
PR #6662 <https://github.com/Genymobile/scrcpy/pull/6662>
This commit is contained in:
parent
a2055c0a47
commit
fe1fd557f7
2 changed files with 10 additions and 5 deletions
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue