diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index bef4e5dde2..c24b3bba71 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -736,13 +736,15 @@ static void gfx_ctx_wl_input_driver(void *data, * on Wayland, so just implement the input driver here. */ if (!input_wl_init(&wl->input, joypad_name)) { - *input = NULL; - *input_data = NULL; + wl->input.gfx = NULL; + *input = NULL; + *input_data = NULL; } else { - *input = &input_wayland; - *input_data = &wl->input; + wl->input.gfx = wl; + *input = &input_wayland; + *input_data = &wl->input; input_driver_init_joypads(); } } diff --git a/gfx/drivers_context/wayland_vk_ctx.c b/gfx/drivers_context/wayland_vk_ctx.c index e852f8fcab..a62b3bfd7d 100644 --- a/gfx/drivers_context/wayland_vk_ctx.c +++ b/gfx/drivers_context/wayland_vk_ctx.c @@ -549,13 +549,15 @@ static void gfx_ctx_wl_input_driver(void *data, * on Wayland, so just implement the input driver here. */ if (!input_wl_init(&wl->input, joypad_name)) { - *input = NULL; - *input_data = NULL; + wl->input.gfx = NULL; + *input = NULL; + *input_data = NULL; } else { - *input = &input_wayland; - *input_data = &wl->input; + wl->input.gfx = wl; + *input = &input_wayland; + *input_data = &wl->input; input_driver_init_joypads(); } } diff --git a/input/common/wayland_common.h b/input/common/wayland_common.h index 9772a1684c..fe421c7642 100644 --- a/input/common/wayland_common.h +++ b/input/common/wayland_common.h @@ -83,10 +83,13 @@ typedef struct output_info struct wl_list link; /* wl->all_outputs */ } output_info_t; +typedef struct gfx_ctx_wayland_data gfx_ctx_wayland_data_t; + typedef struct input_ctx_wayland_data { struct wl_display *dpy; const input_device_driver_t *joypad; + gfx_ctx_wayland_data_t *gfx; int fd; diff --git a/input/drivers/wayland_input.c b/input/drivers/wayland_input.c index 023a400c46..61956f82a5 100644 --- a/input/drivers/wayland_input.c +++ b/input/drivers/wayland_input.c @@ -88,7 +88,7 @@ static void input_wl_poll(void *data) for (id = 0; id < MAX_TOUCHES; id++) { - if (wayland_context_gettouchpos(wl, id, &touch_x, &touch_y)) + if (wayland_context_gettouchpos(wl->gfx, id, &touch_x, &touch_y)) wl->touches[id].active = true; else wl->touches[id].active = false;