I’m looking for the simplest, lowest-cost program to display a window in Win32 and X11 without requiring any dependencies. I got a basic Win32 window working, executable size is 6KB, but it is far from perfect and probably inefficient. I can’t get an equivalent X11 established.
The window will need to be able to redraw text, be resized. Mostly though the problem is the OS doesn’t recognize that a window is opened, or the program crashes immediately.
A basic window with graphics context or a cross-platform GUI application framework? I assume the latter based on the your mention of rendering text, though there are some lightweight immediate-mode APIs that work with the former.
If you are asking for an application framework, does it need to be native?
The most basic window. I finally put together something that works in X11, compiles to only 4.5KB of program size and allows me to print unicode characters to the screen which is most of what I need. The handlers are easy enough with knowledge of the X Protocol. I have an equivalent version in Win32 that already works without dependencies. I wouldn’t use it for a “real” program or call it a windowing system but for putting a window on the screen it is sufficient. I want to clean up the program before sharing it.
Wayland is quite a bit more complicated to do from scratch than the others, there isn’t really a robust way to just link to a system library and call the functions to create a window like there is with Win32 and X11.
You will need to know which Wayland protocols you are using, then generate/implement some bindings for those interfaces and their protocol version. If this is beyond the scope of what you were looking to get into, you could just let it fallback to XWayland on Wayland hosts.
Thanks. Since what I need is very simple, single-window programs and dialog boxes, I don’t think I need to worry too much about moving up to Wayland. I will need to be able to read from the clipboard for copy and pasting.