x_window_test C++ programs which demonstrate the use of the X Window system which allows the creation and control of windows on a remote computer terminal.
You might imagine that the X Window library is a simple set of routines that any user can call to set up interactive graphics. It isn't. The X Window library is complicated and cumbersome. The beginner is advised to take a working copy of an X Window program and proceed slowly and cautiously to try to understand how it works.
On the other hand, there are many useful programs available which use the X Window library. In that case, the user may only need to know a few facts about X Window programs in order to have a satisfactory experience.
If you do run an X windows program, it's often the case that the program is running on a "big" machine (the server) that you've logged into from your "home" machine (the client). The big machine is going to want to display graphics on your home machine, but this will not happen automatically! For this to actually happen properly, two things must be true:
If you are lucky, your terminal software may automatically have set up the permissions and addresses for you. In particular, if you are using ssh, you should be able to get things to work nicely, once you enable X11 forwarding. Running ssh on a PC means you may have to go into a menu in order to enable this. On a Unix machine, you need to have an ssh config file; if it's not in the right place, you can get a copy and put it in the right place by the command:
cp /etc/ssh/ssh_config $HOME/.ssh/configand then make sure that your config file includes the line
ForwardX11 yes
If your terminal software does not set up permissions for you, you may need to enter specific commands to make this happen.
xhost + big_machinewhere big_machine is the Internet address of the big machine.
setenv DISPLAY home_machine:0.0where, again, home_machine is the Internet address of your home machine, where you want the graphics to appear. If you don't know the Internet address of your home machine, you might try the command
hostname --long
Assuming that you are able to figure out how get an X Window program to run, you may also be interested in being able to predefine certain properties of your X Window session. These can include preferred fonts, screen size, or the shape of the icon. Such attributes can be controlled by placing a file called .Xdefaults in your home directory. This file is automatically read by an X Window program, and the information found in there may be used to customize the program to your requests.
The computer code and data files made available on this web page are distributed under the GNU LGPL license.
x_window_test is available in a C version and a C++ version.
SHOWME, a C program which uses the X Window library to display triangulatons.
XBOIDS, a C program which simulates the behavior of a flying flock of animals, displaying the results using X Windows, by Conrad Parker.
XISING, a C program which simulates the variation in ferromagnetism in a material, displaying the results using X Windows.
XWAVES, a C program which simulates the behavior of solution of certain forms of the wave equation, displaying the results using X Windows.
FAREWELL makes a window with a text message, which is dismissed when the user clicks on the mouse.
HELLO prints out the string "Hello, world!" in a window.
GOODBYE makes a window with a pushbutton. When you push the button, it exits.
MEMO prints out its command line arguments in a text window.
You can go up one level to the C++ source codes.