
To compile and link the code sample, just open a terminal in the folder of your source code (too easy under Linux, a bit less easy under Mac 😉 ) and type:

Message is the key of all your troubles, you can easily code the management of the close button. Once you have found that the WM_DELETE_WINDOW Don’t know why, but it’s not obvious to manage the close button. Just catch the KeyPress event and test the presence of the XK_Escape code. This is the simplest way to stop the app. Here is the full source code of a simple X11 app that creates a X window and displays some basic information about the system.

Then using X11 API can be an interesting solution if you need to quickly test an piece of code under Linux and Max OS X (it’s my case…).Īnd nice news, the compilation has the same syntax under both operating systems. Desktop environments like KDE or Gnome are built on top of X11. According to this page, X11 is an option under Mac OS X (on my Lion-based system, X11 is available by default).

X Window (or X11) is the low level windowing system (the equivalent of the Win32 API under Windows) available with Unix / Linux and Mac OS X.
