this is ridiculous. the sample code which implements this is even worse. why is ...

@mxchara@cyberpunk.lol

this is ridiculous. the sample code which implements this is even worse. why is this all necessary?? #Wayland you fuckin' stink. I can't believe that you managed to make something that makes vanilla #X11 programming seem sensible.

(passage from wayland-book dot com)

In summary, the following steps will take you from zero to a window on-screen:

Bind to wl_compositor and use it to create a wl_surface.
Bind to xdg_wm_base and use it to create an xdg_surface with your wl_surface.
Create an xdg_toplevel from the xdg_surface with xdg_surface.get_toplevel.
Configure a listener for the xdg_surface and await the configure event.
Bind to the buffer allocation mechanism of your choosing (such as wl_shm) and allocate a shared buffer, then render your content to it.
Use wl_surface.attach to attach the wl_buffer to the wl_surface.
Use xdg_surface.ack_configure, passing it the serial from configure, acknowledging that you have prepared a suitable frame.
Send a wl_surface.commit request.