wayland: support wl_data_device_manager version < 3

This commit is contained in:
Michael Forney 2019-12-29 23:10:39 -08:00
parent d9c4be0648
commit cdbeae521e
4 changed files with 7 additions and 3 deletions

View File

@ -74,6 +74,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal) #define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal)
#define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data) #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_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_add_listener (*WAYLAND_wl_proxy_add_listener)
#define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor) #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor)
#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) #define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned)

View File

@ -809,8 +809,10 @@ data_device_handle_enter(void *data, struct wl_data_device *wl_data_device,
if (has_mime == SDL_TRUE) { if (has_mime == SDL_TRUE) {
dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
} }
wl_data_offer_set_actions(data_device->drag_offer->offer, if (wl_data_offer_get_version(data_device->drag_offer->offer) >= 3) {
dnd_action, dnd_action); wl_data_offer_set_actions(data_device->drag_offer->offer,
dnd_action, dnd_action);
}
} }
} }

View File

@ -40,6 +40,7 @@ SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *))
SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *)) 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_set_user_data, (struct wl_proxy *, void *))
SDL_WAYLAND_SYM(void *, wl_proxy_get_user_data, (struct wl_proxy *)) 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(uint32_t, wl_proxy_get_id, (struct wl_proxy *))
SDL_WAYLAND_SYM(const char *, wl_proxy_get_class, (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 *)) SDL_WAYLAND_SYM(void, wl_proxy_set_queue, (struct wl_proxy *, struct wl_event_queue *))

View File

@ -381,7 +381,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
} else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
Wayland_display_add_pointer_constraints(d, id); Wayland_display_add_pointer_constraints(d, id);
} else if (strcmp(interface, "wl_data_device_manager") == 0) { } 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) { } else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0) {
d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1); 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) { } else if (strcmp(interface, "org_kde_kwin_server_decoration_manager") == 0) {