You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
fix some gcc-reported warnings
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "looper.h"
|
||||
|
||||
enum {
|
||||
AINPUT_EVENT_TYPE_KEY = 1,
|
||||
AINPUT_EVENT_TYPE_MOTION = 2,
|
||||
@@ -162,7 +164,7 @@ struct AInputEvent fixme_ugly_current_event;
|
||||
|
||||
static inline void make_touch_event(GdkEvent* event, GtkEventControllerLegacy* event_controller, struct AInputEvent *ainput_event)
|
||||
{
|
||||
GtkWidget *window = gtk_event_controller_get_widget(event_controller);
|
||||
GtkWidget *window = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(event_controller));
|
||||
GtkWidget *child;
|
||||
|
||||
gdk_event_get_position(event, &ainput_event->x, &ainput_event->y);
|
||||
@@ -210,7 +212,12 @@ static gboolean on_event(GtkEventControllerLegacy* self, GdkEvent* event, int in
|
||||
make_touch_event(event, self, &ainput_event);
|
||||
write(input_queue_pipe_fd, &ainput_event, sizeof(struct AInputEvent));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME put this in a header file
|
||||
@@ -222,8 +229,9 @@ struct input_queue {
|
||||
void AInputQueue_attachLooper(struct input_queue* queue, struct ALooper* looper, int ident, Looper_callbackFunc callback, void* data)
|
||||
{
|
||||
struct android_poll_source *poll_source = (struct android_poll_source *)data;
|
||||
printf("AInputQueue_attachLooper called: queue: %p, looper: %p, ident: %d, callback %p, data: %p, process_func: %p\n", queue, looper, ident, callback, poll_source, poll_source->process);
|
||||
|
||||
//printf("AInputQueue_attachLooper called: queue: %p, looper: %p, ident: %d, callback %p, data: %p, process_func: %p\n", queue, looper, ident, callback, poll_source, poll_source ? poll_source->process : 0);
|
||||
if (poll_source == NULL)
|
||||
return;
|
||||
int input_queue_pipe[2];
|
||||
if (pipe(input_queue_pipe)) {
|
||||
fprintf(stderr, "could not create pipe: %s", strerror(errno));
|
||||
@@ -231,7 +239,7 @@ void AInputQueue_attachLooper(struct input_queue* queue, struct ALooper* looper,
|
||||
}
|
||||
fcntl(input_queue_pipe[0], F_SETFL, O_NONBLOCK);
|
||||
ALooper_addFd(looper, input_queue_pipe[0], ident, (1 << 0)/*? ALOOPER_EVENT_INPUT*/, callback, data);
|
||||
g_signal_connect(queue->controller, "event", G_CALLBACK(on_event), (gpointer)input_queue_pipe[1]);
|
||||
g_signal_connect(queue->controller, "event", G_CALLBACK(on_event), GINT_TO_POINTER(input_queue_pipe[1]));
|
||||
queue->fd = input_queue_pipe[0];
|
||||
}
|
||||
|
||||
@@ -255,7 +263,7 @@ void AInputQueue_finishEvent(AInputQueue* queue, struct AInputEvent* event, int
|
||||
// should we do something here?
|
||||
}
|
||||
|
||||
void AKeyEvent_getKeyCode (struct AInputEvent *event)
|
||||
int32_t AKeyEvent_getKeyCode(struct AInputEvent *event)
|
||||
{
|
||||
/*
|
||||
* TODO: Minecraft PE misuses this function on an event
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "looper.h"
|
||||
|
||||
typedef int (*Looper_callbackFunc)(int fd, int events, void* data);
|
||||
|
||||
// dummy strong pointer class
|
||||
struct sp {
|
||||
ALooper *ptr;
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#define LOOPER_H
|
||||
|
||||
typedef void ALooper;
|
||||
typedef int (*Looper_callbackFunc)(int fd, int events, void* data);
|
||||
|
||||
ALooper * ALooper_prepare(int opts);
|
||||
void ALooper_wake(ALooper *looper);
|
||||
bool ALooper_isPolling(ALooper *looper);
|
||||
int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
||||
int ALooper_addFd(ALooper* looper, int fd, int ident, int events, Looper_callbackFunc callback, void* data);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -578,7 +578,7 @@ struct XrGraphicsBindingOpenGLESAndroidKHR {
|
||||
|
||||
XrResult bionic_xrCreateSession(XrInstance instance, XrSessionCreateInfo *createInfo, XrSession *session)
|
||||
{
|
||||
struct XrGraphicsBindingOpenGLESAndroidKHR *android_bind = createInfo->next;
|
||||
struct XrGraphicsBindingOpenGLESAndroidKHR *android_bind = (struct XrGraphicsBindingOpenGLESAndroidKHR *)createInfo->next;
|
||||
XrGraphicsBindingEGLMNDX egl_bind = {XR_TYPE_GRAPHICS_BINDING_EGL_MNDX};
|
||||
|
||||
if (android_bind->type == XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR) {
|
||||
@@ -602,7 +602,7 @@ XrResult bionic_xrGetInstanceProperties(XrInstance instance, XrInstancePropertie
|
||||
XrResult ret = xr_lazy_call("xrGetInstanceProperties", instance, instanceProperties);
|
||||
|
||||
strncat(instanceProperties->runtimeName, " (With ATL meta-layer)",
|
||||
XR_MAX_RUNTIME_NAME_SIZE - 1 - strlen(instanceProperties->runtimeName));
|
||||
XR_MAX_RUNTIME_NAME_SIZE - 1 - strlen(instanceProperties->runtimeName));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -620,11 +620,10 @@ XrResult bionic_xrCreateInstance(XrInstanceCreateInfo *createInfo, XrInstance *i
|
||||
"XR_EXT_local_floor",
|
||||
};
|
||||
|
||||
char **old_names = createInfo->enabledExtensionNames, **new_names;
|
||||
const char * const*old_names = createInfo->enabledExtensionNames;
|
||||
const char **new_names;
|
||||
int new_count = createInfo->enabledExtensionCount + ARRRAY_SIZE(extra_exts);
|
||||
|
||||
printf("eee xrCreateInstance\n");
|
||||
|
||||
//FIXME: Leak?
|
||||
new_names = malloc(sizeof(*new_names) * new_count);
|
||||
memcpy(new_names, old_names, createInfo->enabledExtensionCount * sizeof(*old_names));
|
||||
@@ -647,12 +646,9 @@ XrResult bionic_xrCreateInstance(XrInstanceCreateInfo *createInfo, XrInstance *i
|
||||
return xr_lazy_call("xrCreateInstance", createInfo, instance);
|
||||
}
|
||||
|
||||
XrResult bionic_xrCreateReferenceSpace(
|
||||
XrSession session,
|
||||
const XrReferenceSpaceCreateInfo* createInfo,
|
||||
XrSpace* space)
|
||||
XrResult bionic_xrCreateReferenceSpace(XrSession session, const XrReferenceSpaceCreateInfo *createInfo, XrSpace *space)
|
||||
{
|
||||
fprintf(stderr, "xrCreateReferenceSpace(s=0x%x, info={rs_type=%d})\n", session, createInfo->referenceSpaceType);
|
||||
fprintf(stderr, "xrCreateReferenceSpace(s=0x%w64x, info={rs_type=%d})\n", (uint64_t)session, createInfo->referenceSpaceType);
|
||||
|
||||
//FIXME: this is sad for oculus refspace extension it assumes we have...
|
||||
if (createInfo->referenceSpaceType > 100)
|
||||
@@ -684,7 +680,7 @@ struct xr_proc_override {
|
||||
PFN_xrVoidFunction *func;
|
||||
};
|
||||
|
||||
#define XR_PROC_BIONIC(name) {#name, bionic_ ## name }
|
||||
#define XR_PROC_BIONIC(name) {#name, (void (**)(void))bionic_ ## name }
|
||||
|
||||
/* Please keep the alphabetical order */
|
||||
static const struct xr_proc_override xr_proc_override_tbl[] = {
|
||||
@@ -700,10 +696,12 @@ XrResult bionic_xrGetInstanceProcAddr(XrInstance instance, const char *name, PFN
|
||||
printf("xrGetInstanceProcAddr(%s)\n", name);
|
||||
|
||||
struct xr_proc_override *match = bsearch(name, xr_proc_override_tbl,
|
||||
ARRRAY_SIZE(xr_proc_override_tbl), sizeof(xr_proc_override_tbl[0]), strcmp);
|
||||
ARRRAY_SIZE(xr_proc_override_tbl),
|
||||
sizeof(xr_proc_override_tbl[0]),
|
||||
(int (*)(const void *, const void *))strcmp);
|
||||
|
||||
if (match) {
|
||||
*func = match->func;
|
||||
*func = (PFN_xrVoidFunction)match->func;
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user