basic x windows applications

A few years ago, I actually tried to write a GUI program in C#.... and spent WAY too much time just trying to get a handle on how the graphics stack is organized in Windows... even a simple helloworld program required a truckload of setup before writing out the string in the middle of the window. And if graphical elements look out of place, I have to hunt down the API's to adjust just the right values. Not to mention there's different toolkits, best practices, and other details to take care of...
I will agree if you have tried to use WPF. But with WinForm you can create simple GUI for seconds.
 
A few years ago, I actually tried to write a GUI program in C#.... and spent WAY too much time just trying to get a handle on how the graphics stack is organized in Windows... even a simple helloworld program required a truckload of setup before writing out the string in the middle of the window. And if graphical elements look out of place, I have to hunt down the API's to adjust just the right values. Not to mention there's different toolkits, best practices, and other details to take care of...
gtksharp works nicely. (I don't know the status on Windows)
 
Well talking about MacOS you might want to take a look at GNUStep, which is basically a reimplementation of OpenStep from NeXT, which later build the foundation of MacOS. So if you want NeXT-vibes on FreeBSD, that's the way to go.

Coming back to GUI libraries I forgot to mention wxWidgets, which is like a superset for GTK/Qt, MacOS, Windows etc. This means if you program something in it you can compile it either with GTK or Qt under FreeBSD, for example.

Most popular applications realized with it are Filezilla and Audacity.
 
I will agree if you have tried to use WPF. But with WinForm you can create simple GUI for seconds.

If you are stuck with Windows anyway, then WinForms is actually quite a good option. I would recommend using Microsoft's C++/clr compiler extensions just to be able to leverage WinForms whilst also keeping with a bindingless language.

On Linux/BSD however, it is a little too much to drag in the entire .NET framework just for a GUI library.
 
cy@ As the maintainer, you might be a bit more familiar with the codebase than myself these days; perhaps you may want to attempt this slight visual bug?
Typically as port maintainers it's not good idea, if possible, to deviate from the upstream code base, except to fix bugs. Even when fixing bugs one must or should upstream patches. But to maintain FreeBSD-only patches is ill advised for the technical debt it creates. Technical debt can be maintained for a short while, until such time patches can no longer be applied to the code base when patches fail to apply when importing a new <insert package name here>.
 
Here's what I culminated with on my first dive into xlib to close the loop on the discussion...

https://decuser.github.io/development/x-windows/xlib/2023/01/31/xlib-basics.html

01.png


What a ride :)
 
A very cool and detailed walkthrough of raw X11 programming today.

One thing you might like to add is using an Atom (WM_DELETE_WINDOW) to detect a clean close of a window.
(Perhaps just grab the required parts from here).

When I was learning raw Xlib and Xaw, I was very surprised it wasn't really part of the toolkits (unlike Motif).

Code:
...
else if(event.type == KeyPress) {
  printf("Key pressed\n");
  done = 1;
}
else if(event.type == ClientMessage) {
  if((Atom)e.xclient.data.l[0] == wm_delete_window) {
    printf("Closed by the window manager\n");
    done = 1;
  }
}
 
A very cool and detailed walkthrough of raw X11 programming today.

One thing you might like to add is using an Atom (WM_DELETE_WINDOW) to detect a clean close of a window.
(Perhaps just grab the required parts from here).
Thanks. That links to a great example of the code, too. I wish I had seen it before I wrote mine up. I prolly should have made the sections functions, ah well, that'll be for version two. I will add the detection code to both.
 
I prolly should have made the sections functions, ah well, that'll be for version two.
In many ways, I personally prefer example code in one single function. It means I don't need to jump around so much or work out which functions are part of the API and which are "boilerplate" (as soon as C++ inheritance enters, I just click back and look for another example ;).
 
Just figuring out exactly where to stick code snippets (that you authored) so that they work as intended - that's always a challenge, and every windowing toolkit seems to have its own ways of doing it. Setting up templates within an IDE helps some, but it still takes time and skill to do it right, let alone produce something useful. As OP aptly pointed out:
What a ride :)
 
Back
Top