Search code examples
linuxgraphicsgtktoolkitwayland

How to start building a GUI toolkit for wayland


I want to create a GUI toolkit for my desktop environment (because neither gtk nor qt don't fit to my needs) but I don't know how to start. I don't want a cross-platform or display-server independent library, theming options, configurable icons etc. just a few basic widgets for making wayland clients. (widgets like button, entry, label, window and images... and I want to use CSD if it's important)

My problem is that I can't understand how graphics work in wayland (in X you only need to create a window and use XDrawLine etc. right?) also I don't know how to write a graphical toolkit. Can you give me some articles or recommendations on how can I do this?


Solution

  • The easiest way to create a wayland client is to use the wayland-client library. Basically, it abstracts the wire format.

    example:

    #include <stdio.h>
    #include <wayland-client.h>
    
    int main(void)
    {
        struct wl_display *display = wl_display_connect(NULL);
        if (display) {
            printf("Connected!\n");
        } else {
            printf("Error connecting ;(\n");
            return 1;
        }
    
        wl_display_disconnect(display);
        return 0;
    }