Elektrine lite

← Feed

@mxchara@cyberpunk.lol

2026-10-22 17:50 UTC

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.

Replies (2)

  • @mxchara@cyberpunk.lol 2026-10-22 17:52

    the following sample code is like three pages long, to put up ONE WINDOW

    Open ##5202234

  • @menos@todon.eu 2026-10-22 20:07

    @mxchara@cyberpunk.lol Have you seen the thousands of lines of code that are necessary to get any contemporary graphics card to display anything at all? The hundreds of thousands to make it work with *most* hardware you might have? The literally millions of lines once you add all possible input devices? It's complex shit is why. It's not meant to be used directly by application programmers. Luckily you don't *have* to deal with it, you can use an abstraction like Wayland, write a couple hundred lines instead. But Wayland is complex shit and a couple hundred lines is still a lot. It's not meant to be used directly by application programmers. Luckily you don't *have* to deal with it, you can use an abstraction like GTK or Qt or Tk and get it down to a single line if you like. Choose the abstraction that suits you. That's not to say there's no valid criticism of Wayland, but that talking to it over raw sockets is tedious isn't really one.

    Open ##5308198