(Wayland) Buildfixes

This commit is contained in:
twinaphex 2018-08-17 17:42:14 +02:00
parent 1fba7df859
commit ae0d9fd60d
2 changed files with 21 additions and 18 deletions

View File

@ -107,6 +107,7 @@ typedef struct gfx_ctx_wayland_data
#endif
} gfx_ctx_wayland_data_t;
static enum gfx_ctx_api wl_api = GFX_CTX_NONE;
#ifndef EGL_OPENGL_ES3_BIT_KHR
@ -354,9 +355,10 @@ static void touch_handle_down(void *data,
{
int i;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
if (num_active_touches < MAX_TOUCHES)
{
for (i=0; i<MAX_TOUCHES; i++)
for (i = 0; i < MAX_TOUCHES; i++)
{
/* Use next empty slot */
if (!active_touch_positions[i].active)
@ -371,13 +373,13 @@ static void touch_handle_down(void *data,
}
}
}
static void reorder_touches()
static void reorder_touches(void)
{
int i, j;
if (num_active_touches == 0)
return;
for (i=0; i<MAX_TOUCHES; i++)
for (i = 0; i < MAX_TOUCHES; i++)
{
if (!active_touch_positions[i].active)
{
@ -410,7 +412,7 @@ static void touch_handle_up(void *data,
int i;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
for (i=0; i<MAX_TOUCHES; i++)
for (i = 0; i < MAX_TOUCHES; i++)
{
if (active_touch_positions[i].active && active_touch_positions[i].id == id)
{
@ -421,7 +423,7 @@ static void touch_handle_up(void *data,
num_active_touches--;
}
}
reorder_touches(wl);
reorder_touches();
}
static void touch_handle_motion(void *data,
struct wl_touch *wl_touch,
@ -432,7 +434,8 @@ static void touch_handle_motion(void *data,
{
int i;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
for (i=0; i<MAX_TOUCHES; i++)
for (i = 0; i < MAX_TOUCHES; i++)
{
if (active_touch_positions[i].active && active_touch_positions[i].id == id)
{
@ -453,7 +456,8 @@ static void touch_handle_cancel(void *data,
* since they were not ment for us anyway */
int i;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
for (i=0; i<MAX_TOUCHES; i++)
for (i = 0; i < MAX_TOUCHES; i++)
{
active_touch_positions[i].active = false;
active_touch_positions[i].id = -1;
@ -1105,7 +1109,7 @@ static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver)
wl->cursor.default_cursor = wl_cursor_theme_get_cursor(wl->cursor.theme, "left_ptr");
num_active_touches = 0;
for (i=0;i<MAX_TOUCHES;i++)
for (i = 0;i < MAX_TOUCHES;i++)
{
active_touch_positions[i].active = false;
active_touch_positions[i].id = -1;

View File

@ -99,29 +99,28 @@ static int16_t input_wl_lightgun_state(input_ctx_wayland_data_t *wl, unsigned id
return 0;
}
/* forward declaration */
bool wayland_context_gettouchpos(void *data, unsigned id,
unsigned* touch_x, unsigned* touch_y);
static void input_wl_touch_pool(void *data)
{
int id;
unsigned touch_x = 0;
unsigned touch_y = 0;
input_ctx_wayland_data_t *wl = (input_ctx_wayland_data_t*)data;
if (!wl)
return;
unsigned touch_x = 0;
unsigned touch_y = 0;
for (id=0; id<MAX_TOUCHES; id++)
for (id = 0; id < MAX_TOUCHES; id++)
{
if (wayland_context_gettouchpos(wl, id, &touch_x, &touch_y))
{
wl->touches[id].active = true;
}
else
{
wl->touches[id].active = false;
}
wl->touches[id].x = touch_x;
wl->touches[id].y = touch_y;
wl->touches[id].x = touch_x;
wl->touches[id].y = touch_y;
}
}