25

I imagine there isn't a "Beginner's guide to wayland server programming" drifting around the web, and the weston source looks daunting.

Is there a barebones wayland server I can look at to give me an idea where to start? Something I can run under X that I can confirm is recieving input. I'm sure I can go from there.

J V
  • 9,736
  • 7
  • 41
  • 64
  • Maybe you could have look at the source code of Cairo Dock for Wayland http://glx-dock.org/mr_article.php?b=5&a=73 . Just an idea. – Stephane Rolland Oct 04 '14 at 13:47
  • also one of the deleted answer to this question here was a link pointing to the book **Programming Wayland Clients** by Jan Newmarch: http://jan.newmarch.name/Wayland/index.html For the moment I have had tough moments trying to enter this domain, but I do hope this book will finally help. – Stephane Rolland Jun 01 '15 at 08:31
  • I just wanted to ask the same thing. There really should be a beginners guide to writing a wayland compositor, it would make things so much more interesting (tons of amateur devs would flock to create their own wayland compositor, and it would be fun to see which ones would reign as kings at the end of it; might even beat gnome and kde's popularity) – Cestarian Mar 04 '16 at 00:22

3 Answers3

17

Take a look at the Small Wayland Compositor. You can either use it as library to build upon, or check out how it does things internally if you want to start from scratch.

weltensturm
  • 1,989
  • 14
  • 15
8

I wrote a minimal wayland compositor that runs on top of X11 with the hope that it might be useful for other people who want to learn how to write a wayland compositor.
It's about 500 lines of code that are really just the minimal code that is needed to host multiple instances of weston-terminal and move them around.

eyelash
  • 2,197
  • 20
  • 26
  • This is exactly what I wanted to see, granted it actually runs (haven't had a chance to try compiling it and running it yet) although I don't just want it to run within X, I want it to be able to run without it. If it runs, this is exactly what I wanted :) a nice short and simple roughly 500 lines of code that doesn't do much, but works as a starting point. The shorter the better. – Cestarian Mar 04 '16 at 00:24
  • Please tell me if you have any problems running it. Writing a native backend is still on my to do list but it will be a bit more complicated than the X11 backend. – eyelash Mar 07 '16 at 19:40
  • Aw so it doesn't have a native backend :( I might not try it after all then. But please let me know when you have a native backend! – Cestarian Mar 07 '16 at 19:46
  • @Cestarian I also have a [~150 LOC example](https://github.com/eyelash/tutorials/blob/master/drm-gbm.c) of how to use OpenGL without any display server but that's probably not exactly what you are looking for :) – eyelash Mar 07 '16 at 20:03
  • The wayland* files in the root directory also look interesting (https://github.com/eyelash/tutorials) – user1121956 Jun 30 '19 at 21:04
3

I can only recommend to take a look at the KWayland sources (especially if you're interested in how the wayland protocol maps to an object oriented world).
KWayland is an object oriented (C++/Qt) wrapper around the wayland client and server libraries and it also includes a minimal server (tests/renderingservertest.cpp).

eyelash
  • 2,197
  • 20
  • 26