>>109438028
>What the fuck do I use if I want to make a GUI for my program?
You don't need more than Xlib/XCB
Seriously, stop relying on toolkits, just code the thing yourself using the X11 API
>inb4 but muh wayland
Wayfags can just suck it up and use xwayland
>WinAPI
If you're willing to go that far then try X11 API first at least, This is how easy it is to create a window in X11:
#include <stdio.h>
#include <X11/Xlib.h>
#define WIDTH 600
#define HEIGHT 400
int main() {
// Open the display
Display* display = XOpenDisplay(NULL);
if (display == NULL) {
fprintf(stderr, "Failed to open display, check your DISPLAY environment variable\n");
return 1;
}
// Get the root window
Window root_window = DefaultRootWindow(display);
// Create the main window
Window my_window = XCreateSimpleWindow(display, root_window, 0, 0, WIDTH, HEIGHT, 0, 0, 0);
// Register the WM_DELETE_WINDOW and set window manager protocols to recognize it
Atom wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, my_window, &wm_delete_window, 1);
// Select mouse events
long const event_mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
XSelectInput(display, my_window, event_mask);
// Map the window (i.e. show the window)
XMapWindow(display, my_window);
Bool should_close = False;
while (!should_close) {
XEvent event;
XNextEvent(display, &event);
printf("Caught event %d\n", event.type);
switch (event.type) {
case ClientMessage: if ((Atom) event.xclient.data.l[0] == wm_delete_window) should_close = True;
break;
}
}
XCloseDisplay(display);
return 0;
}