I should probably apologize for not reading the thread and links in depth before posting earlier. Although, from reading through the messages, it’s clear I’m not the first person to do this
I have read through it all in depth now and did some more research on top of it. I think it would be valuable to summarize the key points as I see them here. Also, it’s good to acknowledge how complicated all this is - there are a lot of moving parts, so I may get some of this wrong.
So first, I think it’s worth saying Wayland is a protocol and not a full implementation. The protocol defined here: protocol/wayland.xml · main · wayland / wayland · GitLab was brought up in the PR. This XML, along with the Wayland protocol extensions, will get you some of the way. The wayland-scanner works on the client and server protocols to create C header files. So you have the wayland protocol and then libwayland is the library that helps implement the Wayland protocol. It doesn’t act as a server itself; it provides the tools to build a Wayland client or a Wayland compositor (server).
Wlroots is a compositor library, so a library for creating compositors. In the project description, it says it’s the “60k lines you were going to write anyway.” So, there are obviously other libraries built on the Wayland protocol, and from the chat history, it seems people periodically hop in to recommend using one of these instead, and this generates a lot of confusion. I think sticking with wlroots makes the most sense for now.
Beyond that, wlroots lists several binding libraries, and for Haskell, it has hsroots, which looks to be abandoned. It is really interesting to compare hsroots with wlr; you can really see the advantage of the templating done in wlr.
So, with wayland xmls and the relevant Wayland extension XMLs, you can use wayland-scanner to generate C header files. We should probably do this in haskell, but it will likely only provide a subset of the bindings we need; we will still need to hand-roll the rest.
Also, within wlroots, there are more XMLs for wlroots-specific bindings. Again, we can use these to generate more bindings, but also, again, it will only be a subset of what we need.
So, it seems the original goal of the project was to get a subset of the bindings working to get tinywl working:
I think this is still a really good idea, and from the progress report, it looks like you were really close. All that was left was:
- wlr_subcompositor
- wlr_scene
- wlr_xdg_shell
- wlr_cursor
- wlr_xcursor_manager
From reading through the PR, it seems life got in the way for some, and then there was confusion about why the other libraries are using XML and how far this XML would take you if parsed.
I think, considering all the work done and the nice templating set up, it’s worth it to continue and just get tinywl working. From what bindings are needed tinywl will give us a lot in functionality and then we can use this as a core to iterate forward one feature at a time.
Ideally if there is an expert present they can do the XML parsing? , If not I can take it on and see how far I get. I would probably use xml-conduit and Template Haskell. The XML looks pretty straightforward; I don’t think anything like Alex/Happy is needed, but I’m open to suggestions. This might give use a nice win and boost.
So anyway I hope this helps