LJ Archive

Motif 1.2.3 Runtime and Development System for Linux

Dale A. Lutz

Issue #6, October 1994

The Motif toolkit has come to Linux. Dale reviews Sequioa International's Motif Toolkit for Linux.

It is worth pointing out up front that for the most part, Motif is Motif regardless of who you buy it from. A vendor licenses the Motif source code from the Open Software Foundation (OSF), and then ports it to whatever platform they want so they can sell the resulting libraries and executables. Therefore, the main part of the product will not vary much from vendor to vendor, or platform to platform. However, where a vendor gets a chance to differentiate themselves is with the user's manuals and the installation procedure they provide. In my view, Sequoia has done an excellent job in bringing Motif to the Linux platform. Any of the complaints I raise in this article are really complaints about Motif and not about the job Sequoia has done.

What is Motif?

Motif is really three things. First, it is a set of guidelines which define the way an X-Window user interface should look and feel. To the untrained eye, Motif looks an awful lot like Microsoft Windows or OS/2's Presentation Manager. This should come as no surprise, when the history of Motif is considered. The Motif “shell” program provided with the libraries gives this history of Motif:

On December 30, 1988, OSF announced that the user environment component offering will be based on several leading technologies: Digital Equipment Corporation's toolkit technology (widgets) and the joint Hewlett-Packard/Microsoft submission of H-P's 3-D appearance and Microsoft's Presentation Manager-compatible behavior (window manager). The hybrid offering, OSF/Motif environment will provide users with a familiar way to access computer resources across a broad variety of computing hardware platforms, from personal computers to mainframes.

The driving force behind Motif was to unify the graphical user interface look and feel of Unix-based software so that it could compete for the desktop against other standards like the Macintosh or Microsoft Windows. By having a standard look and feel which was common across many hardware platforms, users would benefit by not having to relearn how to interact with software as they moved around and developers would benefit by having a standard to program against.

This brings us to the second part of what Motif is. Motif is a standard set of widgets with a documented interface which may be ported from platform to platform. It is safe to say that if a platform supports X-Window development, then it will not take much effort to make it support Motif. All that's needed are the Motif libraries, or failing that, a source code license from OSF for Motif and a minor bit of effort to port them.

To many people, Motif is just a window manager for X-Windows. This third aspect of Motif is what determines the way window borders are drawn, how windows are resized, iconified, and moved. Generally speaking, it defines how users and applications will interact with their windowing system.

Why Motif?

Why would you want to run Motif on your Linux system? There are three reasons, which parallel the three aspects of Motif discussed above. First, you may want the applications you build to follow the standards for GUI look-and-feel so that your users will feel comfortable sooner and will benefit from consistency across applications. Second, you may want to develop software on your Linux box that you would like to port to other X-Windows platforms. If you use the Motif toolkit to build your code, you will be able to quickly port the user interface to any other platform that has the Motif libraries available.

It is worth pointing out that the TK toolkit which comes with many distributions can be used to create Motif-compliant applications, though programming with it is radically different than programming with the Motif widgets. I will not betray my own bias on this issue; instead I defer you to the endless discussions on this topic which are found in the Usenet comp.lang.tcl and comp.windows.x newsgroups.

The last reason you may want to buy Motif for your Linux box is to run the Motif Window Manager (mwm). You or your clients may wish to have exactly the same look and feel on your Linux box as you enjoy on other machines. While fvwm can closely emulate a Motif look, it is not the same. The mwm window manager seems rock solid and gives your Linux box an exact Motif look. Note that I am not trying to knock fvwm; in fact, I prefer it to mwm because I like its virtual desktop and its low memory use.


What kind of system resources does the Sequoia Motif consume? The manual indicated that 12MB of free disk space were needed under /usr, and 3MB were needed in /tmp. It turned out that 3.6MB of space was needed in the /tmp directory, and only 9.9MB of space were used in the /usr directory.

A Linux kernel newer than 0.99pl13 is required, and XFree86 2.0 must be installed in the standard way (under /usr/X386). The documentation describes how to check this (and in fact the installation script checks it as well). My Slackware 1.1.1 had it in the right spot.

Sequoia also recommends 12MB of RAM to do development (i.e., compiling and linking Motif programs). I have only 8MB and I was able to do it with no more swapping than I normally get when I do compiling. It is usable with 8MB, but certainly it's better with 12MB.


Sequoia has done a great job with their installation instructions. They make it very clear what to do. Motif comes on three 3.5" diskettes. You first install copy these into /tmp using cpio and then you run an installation script. One small complaint I have is that cpio tells you to load a ”tape“, which could confuse some people, but that is cpio's problem and certainly not Sequoia's or Motif's. The installation script verifies that you have X386 installed and won't continue without it. This is nice.

I was done installing in about 10 minutes. The script made all the necessary links and put all the executables and libraries into the right spots. I literally had nothing more to set up or do to run or develop motif programs.

Firing up MWM

I had a ”start MWM“ option on my “fvwm” root menu, so I tried it. Bingo; just like that I was running mwm! To make mwm my default window manager I just had to edit my .xinitrc and replace the last fvwm in the last line with mwm.

The documentation did not describe this, though anyone who is advanced enough to want to use Motif would likely be able to figure it out. This is a minor instance where the product could be improved.

The main area that more instructions are needed is in the customization of the window manager. I had a whale of a time configuring mwm. I thought that all I'd need to do is copy the sample mwmrc file they provide into ~/.mwmrc, make a few changes and I'd be off. Well, an hour later I finally figured it out (after signing onto a friend's machine to check out his .mwmrc).

It turns out that for your own window manager menus to be activated, you must have a set of “Button Bindings” named “DefaultButtonBindings” to tie the buttons to the menus. Now the example mwmrc file does not have a set button bindings named “DefaultButtonBindings” anywhere. Instead, it has “MyExplicitButtonBindings”. So no matter what I did I wasn't picking up my own menu buttons. Finally I read through the manual enough to finally understand, changed the “ExplicitButtonBindings” to “DefaultButtonBindings” and I was in business. This is not a fault of the Linux product, but more generally with the Motif documentation. Most often, users just copy an .mwmrc from someone else they know. However, for Linux people who are often working in isolated environments, it might be a nice touch to supply a more ready-to-go sample .mwmrc or better documentation on setting one up.

The other common thing you may want to change is the keyboard focus policy. This determines how you choose the window into which you will type. I prefer “focus follows mouse”, which means that all I need to do is put the pointer into a window and I can start typing. The default Motif behaviour is to have “click to focus” where a window keeps focus until you click in another window. You can also set whether or not you want the window with focus to be raised automatically to the top of the stack. The two X resources you alter in your .Xdefaults file are:

Mwm*keyboardFocusPolicy: pointer
Mwm*focusAutoRaise: false

This is the type of behaviour I prefer, which is the focus follows the mouse and it does not automatically raise the window with focus. If you prefer the Microsoft windows behaviour, choose the opposite settings (“explicit” for keyboardFocusPolicy and “true” for focusAutoRaise) in your .Xdefaults file, type:

xrdb < .Xdefaults

to update the settings, and finally restart mwm to apply the changes.

What is Included?

The Sequoia Motif comes with UIL (the user interface language of Motif), static and shared Motif libraries, the full set of on-line Motif manual pages, a number of demo programs with source code, and the OSF/Motif user's guide.

If you want to distribute Motif programs, you need to link statically by changing the definitions of the Motif libraries in a makefile to include the static (.a) libraries. You are not allowed to distribute the shared Motif libraries. This makes executables a lot bigger; for a program I wrote, the executable was 130KB when the shared libraries were used and 1.2MB when linked statically. If you are going to be running a lot of Motif programs, it is better to have the shared libraries around and have executables not linked statically. It is possible to distribute executables linked with the shared Motif libraries, but then only people with copies of the shared Motif libraries will be able to run your binary.

The demo programs all make without a hitch on my 8MB system. I believe that development can be done with 8MB, but of course if you have more memory, things will work much faster, since there will be much less swapping.

Performance of mwm

I found mwm to perform very well on my system.

I did check its memory usage, and found that it used 1460KB of memory (according to TOP), while fvwm used only 296KB. Clearly, if you are trying to conserve memory, fvwm is the better way to go. As mentioned earlier, there is no virtual mwm, so if you like having a larger than screen desktop, you'll want to stick with fvwm. However, in terms of a solid consistent sharp look-and-feel, mwm has a slight edge.

fvwm in top:

67 dal   2  0  160  296 296  S  0.8  4.1
0:25 fvwm

mwm in top:

980 dal  3  0 344  1460 608  S  1.7 20.3
0:01 mwm


I was impressed by Sequoia's port of Motif for the Linux platform. They have done a fine job bringing the industry standard to Linux. If portability is a concern for you or you want to use the same tools as the rest of the industry, then I recommend this product.

[Ed: Since this review was written, GUI, Inc. has taken over responsibility for the SWiM Motif distribution, and has released a new version of SWiM based on Motif 1.2.4. GUI is responsible for support, including upgrades, for SWiM. More details will be available in the review of GUI's SWiM Motif 1.2.4 which will be published in a future issue of Linux Journal.

Dale A. Lutz can be reached at (dale@wimsey.com)

LJ Archive