From c4ce3d0a49dd3293a1d6a949ce890f839c28466e Mon Sep 17 00:00:00 2001 From: Ilya Trukhanov Date: Tue, 22 Jan 2019 17:25:22 +0200 Subject: Check if client understands wl_pointer::frame Fixes a crash in SDL2 applications when using locked pointer. SDL2 expects a wl_pointer v1 interface and doesn't provide a handler for the wl_pointer::frame event. This results in a "listener function for opcode 5 of wl_pointer is NULL" abort in wayland-client. Tested on Xonotic v0.8.2 with libSDL2 v2.0.9. Xonotic needs to be ran with "SDL_VIDEODRIVER=wayland xonotic-sdl" for SDL2 to use the wayland backend. --- types/wlr_relative_pointer_v1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/wlr_relative_pointer_v1.c b/types/wlr_relative_pointer_v1.c index c4690087..2247656e 100644 --- a/types/wlr_relative_pointer_v1.c +++ b/types/wlr_relative_pointer_v1.c @@ -271,6 +271,9 @@ void wlr_relative_pointer_manager_v1_send_relative_motion( (uint32_t)(time_msec >> 32), (uint32_t)time_msec, wl_fixed_from_double(dx), wl_fixed_from_double(dy), wl_fixed_from_double(dx_unaccel), wl_fixed_from_double(dy_unaccel)); - wl_pointer_send_frame(pointer->pointer_resource); + uint32_t version = wl_resource_get_version(pointer->resource); + if (version >= WL_POINTER_FRAME_SINCE_VERSION) { + wl_pointer_send_frame(pointer->pointer_resource); + } } } -- cgit v1.2.3