# HG changeset patch # User Michael Forney # Date 1577689839 28800 # Sun Dec 29 23:10:39 2019 -0800 # Branch data-device # Node ID 4459e0d6840d353b42783a7ff1085d0f1be5207f # Parent 0f7577d28c6cd6fba908592a64cbe23e55a60fcd wayland: support wl_data_device_manager version < 3 diff -r 0f7577d28c6c -r 4459e0d6840d src/video/wayland/SDL_waylanddyn.h --- a/src/video/wayland/SDL_waylanddyn.h Wed Jan 01 08:13:40 2020 -0800 +++ b/src/video/wayland/SDL_waylanddyn.h Sun Dec 29 23:10:39 2019 -0800 @@ -74,6 +74,7 @@ #define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal) #define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data) #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data) +#define wl_proxy_get_version (*WAYLAND_wl_proxy_get_version) #define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener) #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor) #define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) diff -r 0f7577d28c6c -r 4459e0d6840d src/video/wayland/SDL_waylandevents.c --- a/src/video/wayland/SDL_waylandevents.c Wed Jan 01 08:13:40 2020 -0800 +++ b/src/video/wayland/SDL_waylandevents.c Sun Dec 29 23:10:39 2019 -0800 @@ -809,8 +809,10 @@ if (has_mime == SDL_TRUE) { dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; } - wl_data_offer_set_actions(data_device->drag_offer->offer, - dnd_action, dnd_action); + if (wl_data_offer_get_version(data_device->drag_offer->offer) >= 3) { + wl_data_offer_set_actions(data_device->drag_offer->offer, + dnd_action, dnd_action); + } } } diff -r 0f7577d28c6c -r 4459e0d6840d src/video/wayland/SDL_waylandsym.h --- a/src/video/wayland/SDL_waylandsym.h Wed Jan 01 08:13:40 2020 -0800 +++ b/src/video/wayland/SDL_waylandsym.h Sun Dec 29 23:10:39 2019 -0800 @@ -40,6 +40,7 @@ SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *)) SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *)) SDL_WAYLAND_SYM(void *, wl_proxy_get_user_data, (struct wl_proxy *)) +SDL_WAYLAND_SYM(uint32_t, wl_proxy_get_version, (struct wl_proxy *)) SDL_WAYLAND_SYM(uint32_t, wl_proxy_get_id, (struct wl_proxy *)) SDL_WAYLAND_SYM(const char *, wl_proxy_get_class, (struct wl_proxy *)) SDL_WAYLAND_SYM(void, wl_proxy_set_queue, (struct wl_proxy *, struct wl_event_queue *)) diff -r 0f7577d28c6c -r 4459e0d6840d src/video/wayland/SDL_waylandvideo.c --- a/src/video/wayland/SDL_waylandvideo.c Wed Jan 01 08:13:40 2020 -0800 +++ b/src/video/wayland/SDL_waylandvideo.c Sun Dec 29 23:10:39 2019 -0800 @@ -381,7 +381,7 @@ } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { Wayland_display_add_pointer_constraints(d, id); } else if (strcmp(interface, "wl_data_device_manager") == 0) { - d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, 3); + d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, SDL_min(3, version)); } else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0) { d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1); } else if (strcmp(interface, "org_kde_kwin_server_decoration_manager") == 0) {