src/video/wayland/SDL_waylandevents.c
changeset 13701 3cc182fa6110
parent 13696 ea20a7434b98
child 13805 4709c1dfeabb
     1.1 --- a/src/video/wayland/SDL_waylandevents.c	Tue Apr 07 11:17:52 2020 -0700
     1.2 +++ b/src/video/wayland/SDL_waylandevents.c	Tue Apr 07 13:30:46 2020 -0400
     1.3 @@ -42,7 +42,15 @@
     1.4  #include "xdg-shell-client-protocol.h"
     1.5  #include "xdg-shell-unstable-v6-client-protocol.h"
     1.6  
     1.7 +#ifdef SDL_INPUT_LINUXEV
     1.8  #include <linux/input.h>
     1.9 +#else
    1.10 +#define BTN_LEFT    (0x110)
    1.11 +#define BTN_RIGHT   (0x111)
    1.12 +#define BTN_MIDDLE  (0x112)
    1.13 +#define BTN_SIDE    (0x113)
    1.14 +#define BTN_EXTRA   (0x114)
    1.15 +#endif
    1.16  #include <sys/select.h>
    1.17  #include <sys/mman.h>
    1.18  #include <poll.h>
    1.19 @@ -436,7 +444,7 @@
    1.20  {
    1.21      struct SDL_WaylandInput *input = data;
    1.22  
    1.23 -    if(wl_seat_interface.version >= 5)
    1.24 +    if(wl_seat_get_version(input->seat) >= 5)
    1.25          pointer_handle_axis_common(input, SDL_FALSE, axis, value);
    1.26      else
    1.27          pointer_handle_axis_common_v1(input, time, axis, value);
    1.28 @@ -997,7 +1005,7 @@
    1.29  };
    1.30  
    1.31  void
    1.32 -Wayland_display_add_input(SDL_VideoData *d, uint32_t id)
    1.33 +Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version)
    1.34  {
    1.35      struct SDL_WaylandInput *input;
    1.36      SDL_WaylandDataDevice *data_device = NULL;
    1.37 @@ -1007,10 +1015,7 @@
    1.38          return;
    1.39  
    1.40      input->display = d;
    1.41 -    if (wl_seat_interface.version >= 5)
    1.42 -        input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 5);
    1.43 -    else
    1.44 -        input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 1);
    1.45 +    input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(5, version));
    1.46      input->sx_w = wl_fixed_from_int(0);
    1.47      input->sy_w = wl_fixed_from_int(0);
    1.48      d->input = input;