|
|
Using the X Window System > Chapter 11 Using Graphics With X WindowsWindow-Smart and Window-Naive Programs |
|
Window-smart applications are able to create and destroy the windows in which they operate. Window-naive (sometimes called window-dumb) applications aren't able to create and destroy windows on their own. They need help from the X Window System. If you are using an existing application, the documentation that comes with the application will tell you how to start it. You don't have to worry whether it is window-smart or window-naive, just follow the directions. If you are writing a new application using Starbase, use the xwcreate and xwdestroy commands. Rather than typing the commands each time you want to test the new program, put the commands in a file, then execute the file to start the application. In this case, the application is window-naive but the file is window-smart. From an hpterm window, type the name of the program you want to run. For example, the following command will start a hypothetical Starbase application named planetarium that displays a moving view of the night sky. Assume that the program is in the /home/ellen/funstuff directory on your computer.
Window-naive programs cannot open and close the window they need to run in, so you must do it for them with clients (a terminal emulator, for example). Some old programs that use the Starbase graphics library are window-naive. Most window-naive programs are able to run in the X Window System environment using the sox11 device driver. The sox11 driver is described in the Starbase Device Drivers manual. But window-naive clients still need help to create and destroy the windows they display their output in. To enable window-naive graphics programs to run within X, you need four special helper clients to create and destroy the windows used by the naive graphics programs. The clients are:
gwind runs in the background and services requests from the other three helper clients. When requested by xwcreate, gwind creates a window in which an application can display its output; when requested by xwdestroy, gwind destroys the window. You don't need to start the gwind program, xwcreate and xwdestroy start and stop it for you. The next sections cover:
xwcreate requests gwind to create a window for a window-naive graphics program to use for its output. The graphics program must exist on the same computer that is running xwcreate. If gwind is not already running when xwcreate is executed, xwcreate will start gwind. Once xwcreate has created a window, you can use the window to run your graphics program. When you finish that application, you can use the same window to run another graphics program if you wish. Use xwcreate from the command line.
where:
The depth option is where you tell the window manager what set of planes you want the window to be in. If you specify nothing, the window is created with the same depth as its parent, or with the same depth as the root if no parent is specified. If you specify a depth, the window will be placed in the image plane with the depth (number of color planes) you specify. The following example creates a window named "foo":
xwdestroy destroys the window created by xwcreate. If that window is the only graphics window present at that time, gwind will also terminate. Use xwdestroy from the command line. xwdestroy [-wmdir path/directory] window1 window2 ... where:
The following example will destroy a window named "foo":
gwindstop destroys all windows created by gwind in the specified directory. If, however, you use xwdestroy to remove the last window opened for graphics use, xwdestroy will terminate gwind. You do not need to use gwindstop.
Use gwindstop from the command line.
|
|