[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 User's Guide



Controlling Client Access to mwm Windows

In support of the mwm Client-Command Interface (CCI), the MWM resource file allows the user to control access of other clients (such as other window managers) to the mwm menus. Clients such as the workspace manager demo which is included with Motif in /demos/programs/workspace/wsm, make use of the CCI to insert commands into mwm's Root and Window menus. When one of these commands is selected, mwm sends a message back to the inserting client specifying the selected command. This allows the end-user to access workspace manager commands through Mwm's menus without using screen real estate for the workspace manager application.

When an application inserts commands using the CCI protocol, the commands are inserted by mwm at the end of the appropriate menu. The location of these inserted commands can be modified by making changes to the Mwm resource file. More specifically, the CCI command placement is controlled using the f.cci command in the menu specifications of the Mwm resource file.

When a client, such as the workspace manager demo, inserts commands using the CCI, it specifies a command using an internal command-name along with a command-label. The command-label is the string that is displayed in the corresponding button of the appropriate Mwm menu. If you wish to control the placement of this command, you must refer to this command in the mwm resource file using the command-name. In addition, each command-name reference must be delimited with brackets as follows:

< 
 
command-name >

To obtain the corresponsing command-name, see the documentation from the inserting application. This documentation should describe the underlying command-names for each command.

The workspace manager demo adds two commands to the Mwm root menu. These commands are "Hide Workspace Manager" and "Switch Workspace". To be more precise, the "Hide Workspace Manager" entry is actually a toggle entry which changes to "Show Workspace Manager" when the Workspace Manager is hidden. The command-names are _WSM_HIDE_WSM and _WSM_SWITCH_WORKSPACE. The Switch Workspace command is actually a command-set and appears in the root menu as a cascade menu with a list of rooms as its sub-menu. The placement of the commands can be controlled using the f.cci function in the mwm resource file. The following sample root menu definition shows how the positions of these commands may be changed:

Menu MyRootMenu
 
{
 
"Root Menu"     f.title
 
DEFAULT_NAME    f.cci <_WSM_HIDE_WSM>
 
DEFAULT_NAME    f.cci <_WSM_SWITCH_WORKSPACE>
 
"New Window"    f.exec "xterm &"
 
"Shuffle Up"    f.circle_up
 
"Shuffle Down"  f.circle_down
 
"Refresh"       f.refresh
 
"Pack Icons"    f.pack_icons
 
 no-label       f.separator
 
"Restart..."    f.restart
 
"Quit..."       f.quit_mwm
 
}

The example above will cause the two commands Hide Workspace Manager and Switch Workspace to be placed at the top of the root menu, below the title. They will not be inserted at the end of the menu.

The format of the f.cci command is the following:

label [
 
mnemonic] [
 
accelerator] f.cci [
 
modifier] 
 
command-reference

The label, mnemonic, and accelerator specifications are the same as for the other Mwm functions. The optional modifiers are described later in this reference page.

The command-reference specifies which command-name or command-names are being refered to. The preceding example refers to a single command and to a single command-set. In the wsm demo, the command "Switch Workspace" cascades to a sub-menu that contains a list of rooms. It is possible to refer to the entries within this sub-menu by concatinating command-names in the command-reference. This can be done be inserting a period between command-name specifications.

The submenu for the Switch Workspace menu entry contains, by default, the entries Room1, Room2, Room3, and Room4. Fortunately, wsm uses the same command-name and command-label for the entries. We can modify the MyRootMenu specification above to include Room1 in the MyRootMenu specification by concatenating the command-set-name _WSM_SWITCH_WORKSPACE with the command-name Room1 as in the following example:

Menu MyRootMenu
 
{
 
"Root Menu"     f.title
 
DEFAULT_NAME    f.cci <_WSM_HIDE_WSM>
 
DEFAULT_NAME    f.cci <_WSM_SWITCH_WORKSPACE>
 
"Home"          f.cci <_WSM_SWITCH_WORKSPACE>.<Room1>
 
"New Window"    f.exec "xterm &"
 
"Shuffle Up"    f.circle_up
 
}

In the preceding example, a menu entry referring to Room1 would appear below the Switch Workspace entry. The label Home would be used instead of the default label specified by wsm.

Often, it is necessary to refer to multiple command-names. This is possible by using a '*' as a wild-card symbol in place of the command-name. For example,

<_WSM_SWITCH_WORKSPACE>.<*>

refers to all command-names in the _WSM_SWITCH_WORKSPACE menu.


[ Previous | Next | Contents | Glossary | Home | Search ]