OPEN LOOK to Motif GUI Transition Guide
  Buscar sólo este libro
Descargar este libro en PDF

TheMotif Environment

1

This chapter describes accessing the set of Motif 1.2.3 libraries and setting up a Motif environment. This chapter contains the following sections:
Important Note to Developerspage 1
Compiling and Linkingpage 4
Shared Library Policypage 5
Future Compatibilitypage 5

Important Note to Developers

As part of each Solaris release, SunSoft ships a separate Software Developer Kit (SDK) product which contains binaries, header files, and documentation used by software developers. Some SDK components only ship header files in the SDK and not the runtime. The SDK is used in tandem with the Solaris runtime product and it is released in that way.
Motif support in Solaris 2.4 is packaged differently than it was in 2.3. This new packaging provides runtime support in the runtime product, and developer support in the Developer's environment. Appendix A, "Solaris 2.4 Packaging," describes the new packaging scheme for this release of Solaris, and outlines the contents of all the Motif packages.
The Motif runtime support includes the following:
  • Dynamic libraries
  • Header files
  • Key bindings
The Motif developer support includes the following:
  • Debug libraries
  • Man pages
  • Demos and sample source
  • Motif window manager (mwm)
The Motif runtime support is not part of the default installation in the Solaris 2.4 runtime product. This package must be explicitly chosen during the Solaris installation or added later using the pkgadd command. Install the runtime support before using the developer support.

Note - Motif applications built on the Solaris 2.4 (S494) version of the Motif runtime package will not work when used with the Motif dynamic libraries delivered in Solaris 2.3 (S1093).

The Motif Window Manager provided with the Solaris 2.4 Developer's Environment is not supported by SunSoft as a runtime user product and must not be distributed to users. mwm is only included in the Developers environment for development purposes. SunSoft recommends using the default olwm window manager.

Using the Motif Window Manager with OpenWindows

This section describes how to set up your environment to use the Motif Window Manager and to access it from OpenWindows.
· Setting Up the Motif Environment
To set up the environment to support Motif development, set the following variables in the initialization file for your shell (for example .profile for the Bourne or Korn shell or .login for the C shell).
  1. Set the MOTIFHOME environment to /usr/dt.

  2. Set the OPENWINHOME environment variable to /usr/openwin.

  1. Set the LD_LIBRARY_PATH environment variable to include the values

  $MOTIFHOME/lib:$OPENWINHOME/lib.

  1. Include the value$MOTIFHOME/bin in your PATH environment variable.

  2. If SUNWfwm is installed, add /opt/SUNWmfwm/bin to your PATH .

  3. Set the UIDPATH environment variable to /opt/SUNWmfdm.

  4. Include the value $MOTIFHOME/lib/%T/%N%S in your

  XFILESEARCHPATH environment variable.

  1. Set the XMBINDDIR environment variable to

  $MOTIFHOME/lib/bindings.

  1. Both developers and users need to add /usr/dt/man to their MANPATH. If developers have installed the optional SUNWmfwm, they need to add /opt/SUNWmfwm/man to their MANPATH.

  1. Source the initialization file by typing . .profile for the Bourne or Korn shell, or source .cshrc for the C shell.

    Alternatively, you can log out and log in again so that the changes are recognized in your complete environment.

    You can run Motif clients with the OPEN LOOK Window Manager (olwm) without making further changes.

· Setting Motif Window Manager as the Default
The openwin script indirectly starts the OPEN LOOK Window Manager (olwm). If you want the script to start the Motif Window Manager, you can edit the .xinitrc file in your home directory.

Note - mwm is only available if the Solaris 2.4 SUNWmfwm is installed.

  1. Edit the .xinitrc file in your home directory. If you do not have an .xinitrc file in your home directory, copy the file $OPENWINHOME/lib/Xinitrc to your home directory and rename it .xinitrc.

  1. Replace olwm with mwm in the following line:

       olwm -syncpid $pid &

  1. Save the changes and quit the .xinitrc file.

· Enabling Quit on the Workspace Menu
The Motif Window Manager does not have an option to exit mwm. Use the following steps to enable Quit on the Workspace menu.
  1. Type cp /opt/SUNWmfwm/lib/system.mwmrc $HOME/.mwmrc and press Return.

  2. Edit the $HOME/.mwmrc file and remove the leading exclamation mark (!) from the following line:

       !"Quit..."   f.quit_mwm

· Enabling Drag and Drop for the Motif Window Manager
To ensure the OpenWindows drag-and-drop option runs correctly with mwm, modify the openwin-sys script in /usr/openwin/lib
($OPENWINHOME/lib).

  1. Become superuser, and edit the $OPENWINHOME/lib/openwin-sys script. Remove the comment from the following line: #dsdm &

  2. Save the changes and quit the editing file.

  3. Exit the window system and restart it.

    This change initiates the drop-site database manager and restarts the window system.

Compiling and Linking

Install Motif from Solaris 2.4

You install runtime package from Solaris 2.4 and Motif from the Software Developers Kit. The Motif header files required for application development are located under /usr/dt/include. The Motif libraries are located in /usr/dt/lib.
When you compile Motif programs, include the following compiler syntax to enable the compiler to find the Motif and X Window System header files:

  -I$MOTIFHOME/include -I$OPENWINHOME/include  

Use the following compiler syntax to direct the linker to the correct shared libraries as shown in the following:

  -L$MOTIFHOME/lib -L$OPENWINHOME/lib  

The following is an example of a compile and link-line for a Motif application that does not use uil:

  cc -o myprog -I$MOTIFHOME/include -I$OPENWINHOME/include \  
  myprog.c -L$MOTIFHOME/lib -lXm -L$OPENWINHOME/lib  -lXt -lX11  

By default, the SPARCworks C compiler dynamically links your application against the shared Motif, Intrinsics, and Xlib libraries. The shared library files must be accessible to the application at run time.

Shared Library Policy

SunSoft will increment the major version number of each shared Motif library whenever there are binary incompatible differences from the previous release. SunSoft will make available (either on the Motif distribution or through some other channel), all prior versions of each library. This will ensure that your applications linked with a particular release can continue to run, even after a new Motif release has been installed.

Future Compatibility

Developers who used Motif 1.2 to subclass widgets need to be aware of potential binary compatibility problems with future releases. Internal Motif widget data structures may be changed, breaking any subclass that relies on the position of fields in these data structures.
Motif provides a mechanism that a developer can use to avoid such problems. Refer to the Motif Programmer's Reference manual.
A demonstration of this mechanism is provided in /opt/SUNWmfdm/src/dogs.