Skip to content

Add some stubs for newer protocol bits in the data manager, claiming support for protocol version 3. #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alarixnia
Copy link
Contributor

This is enough to allow some SDL2 applications to work, e.g. quakespasm. It was done in my fork of swc that adds support for NetBSD and a new "seat" for the wscons input API, in case you're interested in that.

and claim support for protocol version 3.

This is enough to allow some SDL2 applications to work.
Copy link
Owner

@michaelforney michaelforney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I'm curious why SDL2 requires these features in wl_data_device. Do you have any links to the relevant code?

I'll need to do a bit of reading of the spec before merging this. Sorry about the wait.

@@ -59,6 +67,7 @@ set_selection(struct wl_client *client, struct wl_resource *resource, struct wl_
static const struct wl_data_device_interface data_device_impl = {
.start_drag = start_drag,
.set_selection = set_selection,
.release = release
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be .release = destroy_resource, which will call wl_resource_destroy, which calls the destructor (data_device_destroy), and then destroys the wl_resource.

@alarixnia
Copy link
Contributor Author

alarixnia commented Dec 18, 2019

$ crawl
wl_registry@2: error 0: invalid version for global wl_data_device_manager (16): have 1, wanted 3
Failed to initialise SDL: The video driver did not add any displays

I think it's just requesting version 3 for no good reason. It's also just defining stubs for these capabilities in SDL_waylandevents.c:

https://github.com/spurious/SDL-mirror/blob/master/src/video/wayland/SDL_waylandevents.c#L681

SDL_waylandvideo.c requests version 3:

https://github.com/spurious/SDL-mirror/blob/master/src/video/wayland/SDL_waylandvideo.c#L384

I should correct my first post that this actually allows (all?) SDL2 applications to work, except those also using GLEW. I previously had a bug that was preventing non-GL applications from running, but that seems resolved. So you can run milkytracker, Dungeon Crawl, mpv, etc.

@michaelforney
Copy link
Owner

Thanks for the links. SDL should definitely not be trying to bind version 3 of wl_data_device_manager if the compositor advertises a lower version. That will always result in a protocol error. I submitted a patch to fix that at https://bugzilla.libsdl.org/show_bug.cgi?id=4924.

It looks like SDL does use the v3 request wl_data_offer_set_actions, but I think it may be possible to support v1 and v2 by just making that request conditional on the data device version being >= 3.

On the swc side, I went ahead and pushed support for v2 first, since that was an easy change. For v3, apart from the two stubs you added, I think we also need add wl_data_source.set_actions. Otherwise, if a client makes that request, it will crash the compositor (trying to call a NULL request handler).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants