diff -r 42ef99a1bde2 src/video/wayland/SDL_waylandevents.c --- a/src/video/wayland/SDL_waylandevents.c Thu Apr 02 12:27:29 2020 -0700 +++ b/src/video/wayland/SDL_waylandevents.c Sun Apr 05 16:48:13 2020 +0100 @@ -43,7 +43,15 @@ #include "xdg-shell-client-protocol.h" #include "xdg-shell-unstable-v6-client-protocol.h" +#ifdef SDL_INPUT_LINUXEV #include +#else +#define BTN_LEFT (0x110) +#define BTN_RIGHT (0x111) +#define BTN_MIDDLE (0x112) +#define BTN_SIDE (0x113) +#define BTN_EXTRA (0x114) +#endif #include #include #include @@ -437,7 +445,7 @@ { struct SDL_WaylandInput *input = data; - if(wl_seat_interface.version >= 5) + if(wl_seat_get_version(input->seat) >= 5) pointer_handle_axis_common(input, SDL_FALSE, axis, value); else pointer_handle_axis_common_v1(input, time, axis, value); @@ -998,7 +1006,7 @@ }; void -Wayland_display_add_input(SDL_VideoData *d, uint32_t id) +Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) { struct SDL_WaylandInput *input; SDL_WaylandDataDevice *data_device = NULL; @@ -1008,10 +1016,7 @@ return; input->display = d; - if (wl_seat_interface.version >= 5) - input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 5); - else - input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 1); + input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(5, version)); input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); d->input = input; diff -r 42ef99a1bde2 src/video/wayland/SDL_waylandevents_c.h --- a/src/video/wayland/SDL_waylandevents_c.h Thu Apr 02 12:27:29 2020 -0700 +++ b/src/video/wayland/SDL_waylandevents_c.h Sun Apr 05 16:48:13 2020 +0100 @@ -32,7 +32,7 @@ extern void Wayland_PumpEvents(_THIS); -extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id); +extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version); extern void Wayland_display_destroy_input(SDL_VideoData *d); extern SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input); diff -r 42ef99a1bde2 src/video/wayland/SDL_waylandvideo.c --- a/src/video/wayland/SDL_waylandvideo.c Thu Apr 02 12:27:29 2020 -0700 +++ b/src/video/wayland/SDL_waylandvideo.c Sun Apr 05 16:48:13 2020 +0100 @@ -364,7 +364,7 @@ } else if (strcmp(interface, "wl_output") == 0) { Wayland_add_display(d, id); } else if (strcmp(interface, "wl_seat") == 0) { - Wayland_display_add_input(d, id); + Wayland_display_add_input(d, id, version); } else if (strcmp(interface, "xdg_wm_base") == 0) { d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, 1); xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL);