To modify the Xfontsel application so that it will be able to communicate with the Xedit application, you need to modify the following files:
the Xfontsel.c file
the Makefile
You also need to create a new file to declare the ToolTalk ptype for the Xfontsel application.
For the ToolTalk demonstration, Xfontsel needs to know:
where to find the ToolTalk header file
how to handle a ToolTalk message when it receives one
how to process an error caused by a ToolTalk message
how to behave when the apply button is activated for the new change fonts command
Xfontsel also needs to display an apply button and a command box to make the font change. In addition, you need to add code to tell Xfontsel when to send a ToolTalk callback message, and how to join the ToolTalk session. These modifications are made in the Xfontsel.c file, as shown in Example B-4 with commented explanations.
Next, modify the Makefile for the Xfontsel program so that it uses the ToolTalk libraries. To do this, add the -ltt option to the as follows:
LOCAL_LIBRARIES = -ltt $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) |
The ToolTalk types mechanism is designed to help the ToolTalk service route messages. You first define a process type (ptype), and then compile the ptype with the ToolTalk type compiler, tt_type_comp. For the ToolTalk demonstration, you need to create a ptype file for the Xfontsel application, as shown in the following listing..
directory_name is the pathname to the directory in which the modified Xfontsel files reside.
When your tool declares a ptype, the message patterns listed in it are automatically registered; the ToolTalk service then matches messages it receives to these registered patterns. These static message patterns remain in effect until the tool closes communication with the ToolTalk service.
After you have created the ptype file, you need to install the ptype. To do this, run the ToolTalk type compiler as follows:
machine_name% tt_type_comp xfontsel.ptype |
where xfontsel.ptype is the name of your ptype file.
After you have made the indicated changes to the Xfontsel files, created a ptype file, and installed the pytpe, compile the Xfontsel program.