Skip to content

Commit

Permalink
wayland: support wl_data_device_manager version < 3
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelforney committed Dec 30, 2019
1 parent d9c4be0 commit cdbeae5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/video/wayland/SDL_waylanddyn.h
Expand Up @@ -74,6 +74,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
#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)
Expand Down
6 changes: 4 additions & 2 deletions src/video/wayland/SDL_waylandevents.c
Expand Up @@ -809,8 +809,10 @@ data_device_handle_enter(void *data, struct wl_data_device *wl_data_device,
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);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/video/wayland/SDL_waylandsym.h
Expand Up @@ -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(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 *))
Expand Down
2 changes: 1 addition & 1 deletion src/video/wayland/SDL_waylandvideo.c
Expand Up @@ -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) {
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) {
Expand Down

0 comments on commit cdbeae5

Please sign in to comment.