Wayland: An Introduction

The first steps of the Handmade Hero project is to get something written to the screen. The Win32 API offers a fairly simple way to do so. However, Linux is in a somewhat frustratingly different situation. Traditionally, you would have gone one of three routes:

  1. Create an X11 client
  2. Use a desktop app framework like GTK or QT
  3. Use SDL or similar framework

This is still good advice. However, it somewhat flies into the face of the spirit of Handmade Hero. Wayland is starting to replace X11 and it has some nice things. It's programmed in C, it's much lighter weight than X11, it's closer to the OS than any of the other frameworks.Why not try and use Wayland directly for getting started with Handmade Hero?

I won't be doing the same pacing as Handmade Hero, but I will try and code pieces at a time and create snapshots in the repository for anyone following along that cares to can see my steps.

This is where we get into a place where I feel that I should put the disclaimer that you very likely should not do this for any production applications. You'll spend a lot of time solving problems that frameworks have already solved. However, if you want to learn how some of them work, this is a great path.

I also feel I should mention that I'm just some dude who wants to see what he can learn and leave a trail in case someone else is trying to learn it too.


About Wayland

Wayland is a compositor and protocol for communication with the desktop environment. The Wayland Site does a pretty good job explaining what it is and the architecture document is really helpful for understanding things. Likely you'll need to code a little bit, wonder why we have to structure it the way we do, read the Wayland documentation, and iterate that loop. I've coded this client from scratch several times and each time I learn a little more about Wayland.

Our goal will be to get a Wayland client with a backbuffer similar to the Windows client in Handmade Hero. I'll be posting any resources I used at the bottom of each section.

With that said, let's get started!

Next