diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 14dec3e3e9..bc81edebbd 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -609,9 +609,6 @@ static void gfx_ctx_wl_set_swap_interval(void *data, int swap_interval) #endif } -/* Forward declaration */ -void gfx_ctx_wl_show_mouse(void *data, bool state); - static bool gfx_ctx_wl_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) @@ -894,26 +891,6 @@ static void gfx_ctx_wl_set_flags(void *data, uint32_t flags) wl->core_hw_context_enable = true; } -void gfx_ctx_wl_show_mouse(void *data, bool state) -{ - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - if (!wl->wl_pointer) - return; - - if (state) - { - struct wl_cursor_image *image = wl->cursor.default_cursor->images[0]; - wl_pointer_set_cursor(wl->wl_pointer, wl->cursor.serial, wl->cursor.surface, image->hotspot_x, image->hotspot_y); - wl_surface_attach(wl->cursor.surface, wl_cursor_image_get_buffer(image), 0, 0); - wl_surface_damage(wl->cursor.surface, 0, 0, image->width, image->height); - wl_surface_commit(wl->cursor.surface); - } - else - wl_pointer_set_cursor(wl->wl_pointer, wl->cursor.serial, NULL, 0, 0); - - wl->cursor.visible = state; -} - static float gfx_ctx_wl_get_refresh_rate(void *data) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; diff --git a/gfx/drivers_context/wayland_vk_ctx.c b/gfx/drivers_context/wayland_vk_ctx.c index 48c85d266f..79cd81f7b0 100644 --- a/gfx/drivers_context/wayland_vk_ctx.c +++ b/gfx/drivers_context/wayland_vk_ctx.c @@ -451,9 +451,6 @@ static void gfx_ctx_wl_set_swap_interval(void *data, int swap_interval) } } -/* Forward declaration */ -void gfx_ctx_wl_show_mouse(void *data, bool state); - static bool gfx_ctx_wl_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) @@ -688,26 +685,6 @@ static void gfx_ctx_wl_set_flags(void *data, uint32_t flags) wl->core_hw_context_enable = true; } -void gfx_ctx_wl_show_mouse(void *data, bool state) -{ - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - if (!wl->wl_pointer) - return; - - if (state) - { - struct wl_cursor_image *image = wl->cursor.default_cursor->images[0]; - wl_pointer_set_cursor(wl->wl_pointer, wl->cursor.serial, wl->cursor.surface, image->hotspot_x, image->hotspot_y); - wl_surface_attach(wl->cursor.surface, wl_cursor_image_get_buffer(image), 0, 0); - wl_surface_damage(wl->cursor.surface, 0, 0, image->width, image->height); - wl_surface_commit(wl->cursor.surface); - } - else - wl_pointer_set_cursor(wl->wl_pointer, wl->cursor.serial, NULL, 0, 0); - - wl->cursor.visible = state; -} - static float gfx_ctx_wl_get_refresh_rate(void *data) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; diff --git a/input/common/wayland_common.c b/input/common/wayland_common.c index 74d7729f94..53af827314 100644 --- a/input/common/wayland_common.c +++ b/input/common/wayland_common.c @@ -135,7 +135,25 @@ void keyboard_handle_repeat_info(void *data, * repeat working. We'll have to do it on our own. */ } -void gfx_ctx_wl_show_mouse(void *data, bool state); +void gfx_ctx_wl_show_mouse(void *data, bool state) +{ + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + if (!wl->wl_pointer) + return; + + if (state) + { + struct wl_cursor_image *image = wl->cursor.default_cursor->images[0]; + wl_pointer_set_cursor(wl->wl_pointer, wl->cursor.serial, wl->cursor.surface, image->hotspot_x, image->hotspot_y); + wl_surface_attach(wl->cursor.surface, wl_cursor_image_get_buffer(image), 0, 0); + wl_surface_damage(wl->cursor.surface, 0, 0, image->width, image->height); + wl_surface_commit(wl->cursor.surface); + } + else + wl_pointer_set_cursor(wl->wl_pointer, wl->cursor.serial, NULL, 0, 0); + + wl->cursor.visible = state; +} static void pointer_handle_enter(void *data, struct wl_pointer *pointer, diff --git a/input/common/wayland_common.h b/input/common/wayland_common.h index e772978250..4fd86b0842 100644 --- a/input/common/wayland_common.h +++ b/input/common/wayland_common.h @@ -177,6 +177,8 @@ void handle_xkb_state_mask(uint32_t depressed, void free_xkb(void); #endif +void gfx_ctx_wl_show_mouse(void *data, bool state); + void handle_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel);