Miscellaneous Operating Systems/Hardware

Motif resources for SGI IM fonts and sizes?

Using OpenMotif (now renamed to Motif-2.3.4 and under LGPL) for running old X11/Motif applications, I've become quite bored of the boring default fonts and sizes provided by standard Motif. Widgets are very small, fonts look amateurish, and it really looks far from professional.

Yes, I know MaXX isn't open source, and that standard Motif doesn't provide theming, but... OTOH it should be possible to exactly match IndigoMagic fonts and widget sizes by correctly defining Motif resources (sure, there wouldn't be round borders, nor red ticks on toggle buttons, nor any other of the IndigoMagic candy, but... I believe it could look quite professional, or at least vastly improved if compared to the standard Motif look).

Has anybody tried something like this? Do you have any good-looking Motif resources file at hand?

NOTE: I'm assuming not running under IRIX (otherwise I know how to enable IM-look via the famous couple of Motif resources).
Dunno if MaXX is compiled with support for editres, but if it is then changing the fonts is easy. Otherwise, if there's no app-defaults file you can use xwininfo and xprop to find out as much as you can about the app (in particular you need its X Window classname) and then you can start hit-or-miss hacking up an app-defaults file for it... :roll:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:
SGI Motif font defaults:

Code: Select all

menu font:  -adobe-helvetica-bold-o-normal-*-14-*-*-*-*-*-*-*
label font: -adobe-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*
text font:  -adobe-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*

sub-text:   -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*


You will find that the replacements for Adobe Helvetica in most GNU/Linux distributions just aren't the same and that the modern X11 font anti-aliasing makes the motif UI stuff look much 'fatter' and 'blacker' - no matter what you do.

Like vishnu said, editres is your friend, though you may find that your GNU/Linux distribution doesn't install editres by default anymore.
:Fuel: redbox 800Mhz 4Gb V12
Thanks a lot for the fonts hints!!

Man... it is impressive what you can accomplish with X11 resources!! :shock:

After quite a lot of trial & error, measuring colors, pixel sizes, and pixel distances on the screen, I've arrived to a setting of X resources which shockingly resembles the original SGI look 'n' feel. I've tried to match the colors, pixel sizes and distances of all widgets (except the dials and perhaps other very rarely used widgets).

The "size" of a widget with SGI look 'n' feel isn't straightforward to measure because IM adds a 1-pixel dark border around widgets (which cannot be done with standard Motif), so when in doubt on whether to consider or not the dark border in the size, I used the choice of whatever looked aesthetically "more correct".

As you may notice in the .Xdefaults file, I had to make XmScrollbars 2 pixels larger when they belong to an XmScrolledWindow. I don't know the reason, but they have to be 2 pixels larger in order to have the same size as the other ones.

If you have XmScale widgets, make their XmNscaleHeight or XmNscaleWidth to be 15 pixels (don't set both, set only the proper one depending on whether the XmScale is vertical or horizontal, respectively.

If you have togglebuttons or pushbuttons with icons (pixmaps) instead of text, make them have a 3-pixel marginHeight and marginWidth.

This is with standard Motif 2.3.4 (now LGPLed). No modifications to the original source code. It's very shocking that you can get so close to the SGI look without modifying a single line of Motif.

Please, if you achieve greater accuracy by retouching these resources, post the modifications, .

Also note that it should be straightforward to use other SGI color schemes. I used the Indigo Magic default because it's the one you always remember with romanticism 8-)

The .Xdefaults file (in order to use it for a given application, just replace "NEdit" with the application class name)

Code: Select all

!
! These are valid for all applications (replace "NEdit" with the proper application class)
NEdit*menuBar*XmPushButton.marginHeight: 2
NEdit*menuBar*XmPushButton.marginWidth: 9
NEdit*menuBar*XmCascadeButton.marginHeight: 2
NEdit*menuBar*XmCascadeButton.marginWidth: 9
NEdit*menuBar*XmToggleButton.marginHeight: 2
NEdit*menuBar*XmToggleButton.marginWidth: 9
NEdit*menuBar.marginHeight: 0
NEdit*optionPane*marginHeight: 0
NEdit*optionPane*marginWidth: 0
NEdit*XmPushButton*marginHeight: 6
NEdit*XmPushButton*marginWidth: 6
NEdit*XmPushButtonGadget*marginHeight: 6
NEdit*XmPushButtonGadget*marginWidth: 6
NEdit*XmToggleButton*indicatorOn: XmINDICATOR_CHECK_BOX
NEdit*XmToggleButton*indicatorSize: 16
NEdit*XmToggleButtonGadget*indicatorOn: XmINDICATOR_CHECK_BOX
NEdit*XmToggleButtonGadget*indicatorSize: 16
NEdit*XmScrollBar*sliderMark: XmTHUMB_MARK
NEdit*XmScrollBar*width: 20
NEdit*XmScrollBar*height: 20
NEdit*XmScrolledWindow.XmScrollBar.width: 22
NEdit*XmScrolledWindow.XmScrollBar.height: 22
NEdit*XmScrolledWindow.XmScrollBar.highlightThickness: 0
NEdit*XmScrolledWindow.spacing: 0
NEdit*XmScale*highlightThickness: 1
NEdit*XmList*highlightThickness: 0
NEdit*XmList.listMarginWidth: 3
NEdit*XmList.listSpacing: 2
NEdit*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-*-*-*-*-iso8859-1
NEdit*XmMenuShell*fontList: -*-helvetica-bold-o-normal-*-14-*-*-*-*-*-iso8859-1
NEdit*fontList: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
NEdit*XmLabel*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
NEdit*XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
NEdit*XmScale*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
NEdit*foreground: #000000
NEdit*highlightColor: #000000
NEdit*background: #c1c1c1
NEdit*XmMenuShell*background: #c1c1c1
NEdit*XmPushButton*background: #999999
NEdit*XmPushButton*topShadowColor: #e6e6e6
NEdit*XmPushButton*bottomShadowColor: #4c4c4c
NEdit*XmPushButtonGadget*background: #999999
NEdit*XmPushButtonGadget*topShadowColor: #e6e6e6
NEdit*XmPushButtonGadget*bottomShadowColor: #4c4c4c
NEdit*XmCascadeButtonGadget*background: #999999
NEdit*XmCascadeButtonGadget*topShadowColor: #e6e6e6
NEdit*XmCascadeButtonGadget*bottomShadowColor: #4c4c4c
NEdit*XmList*background: #999999
NEdit*XmScrollBar*background: #999999
NEdit*XmScrollBar*troughColor: #999999
NEdit*XmScrollBar*topShadowColor: #e6e6e6
NEdit*XmScrollBar*bottomShadowColor: #4c4c4c
NEdit*XmScale*troughColor: #999999
NEdit*XmTextField*background: #b98e8e
NEdit*XmText*background: #b98e8e
!
! These are NEdit-specific
NEdit*statsLine.background: #c1c1c1
NEdit*statsLine.foreground: #000000
NEdit.main.pane.scrolledW.text.background: white
NEdit.main.pane.scrolledW.text.popup_popupMenu.popupMenu.background: #c1c1c1
NEdit*replaceDialog*XmPushButton.marginWidth:   6
NEdit*pane.sashHeight: 11
NEdit*pane.sashWidth: 11
NEdit*text.selectionArrayCount: 3
NEdit*text.background: #b98e8e
NEdit*text.foreground: #000000
NEdit*highlightBackground: red
NEdit*highlightForeground: black
NEdit*XmText.translations: #override \
Ctrl~Alt~Meta<KeyPress>v: paste-clipboard()\n\
Ctrl~Alt~Meta<KeyPress>c: copy-clipboard()\n\
Ctrl~Alt~Meta<KeyPress>x: cut-clipboard()\n
Edited the previous post, to include some fixes and enhancements that I found today. Now, as you can see in the updated screenshot, scrollbars have a more accurate width, and they have the 3-line thumb mark too (I didn't know, but standard Motif supports that feature out of the box). I've also fixed all inaccuracies that I was aware of. Now, all the Motif apps I tried render "reasonably" exact (in terms of sizes and colors) in standard Motif compared to a real SGI.
Well done cesss!

I had to go far back for people reporting something similar. I have found a post by squeen listing his nedit .Xdefaults file viewtopic.php?f=15&p=43500
But can't verify directly if this matches yours, since my nedit on Ubuntu 15.10 segfaults when installing from universe. I think that segfault is a hint :)
:Crimson: :PI: :Indigo: :O2: :Indy: :Indigo2: :Indigo2IMP: :O200: :O2000: :Onyx2:
dexter1 wrote: Well done cesss!

I had to go far back for people reporting something similar. I have found a post by squeen listing his nedit .Xdefaults file viewtopic.php?f=15&p=43500
But can't verify directly if this matches yours, since my nedit on Ubuntu 15.10 segfaults when installing from universe. I think that segfault is a hint :)

I think the .Xdefaults from that ancient thread assumes running on IRIX, because it doesn't specify IM colors and widget sizes, and sets "sgimode", which isn't understood by standard Motif.

Anyway, it's important to note that my effort is targeted to all Motif applications. I used NEdit as an example for the screenshot, but some of the resources have no effect on NEdit. In fact I didn't tune the settings with NEdit, but with other Motif demos for which I had real IRIX screenshots with IndigoMagic look enabled.

In my tests with several Motif demos, this resource set provides a +/- 1 pixel accuracy (in positions and sizes) comparing standard Motif (on XQuartz), with IndigoMagic Motif running on a real IRIX workstation. Exact pixel accuracy isn't possible because of the dark border which SGI Motif adds in all widgets, which can't be done with standard Motif (and if you emulate it by making the widget larger, you're losing positions accuracy too).

One place which isn't pixel accurate is the width of option menus. Their height is pixel exact, but their width isn't. I know how to fix it (it depends on the width of the pushbutton childs in the pop-up menu, but I was more interested in the height than in the width. I left it as an exercise for the future.

Also, maybe accelerators and menu entries doesn't have a 100% exact horizontal margin, because I tested and measured the vertical space between menu entries, but not between entries and the menu border.

Regarding your NEdit segfault in Ubuntu, I don't trust any Motif (nor Xt) stuff that comes from Linux, because, honestly, X11 on Linux is GTK only, which means that Motif and Xt are almost never tested by distro packagers.

My advice is to download Motif 2.3.4, and compile it. Then download NEdit and compile it too, with Motif 2.3.4. I've never found any problem getting NEdit that way.
Just as an aside, Nedit ignores a _lot_ of the Xresources mechanism and has many Xresrouces hardcoded. I ripped out a bunch of them in the latest Nedit to make it be a bit more sensitive to the sgiMode and IMD schemes thing. Never made a patch though.
jimmer wrote: Just as an aside, Nedit ignores a _lot_ of the Xresources mechanism and has many Xresrouces hardcoded. I ripped out a bunch of them in the latest Nedit to make it be a bit more sensitive to the sgiMode and IMD schemes thing. Never made a patch though.

Yes, that's true, but it's only a problem when running on IRIX. If a resource is defined in your .Xdefaults, NEdit honors it even if it has a hardcoded default for it. When running on IRIX, the sgiMode resources values come from somewhere that has lower priority that the NEdit hardcoded values. But if they were in .Xdefaults, NEdit would honor them. So, this issue isn't a problem with the resource set above... NEdit does honor it.

One interesting fact is that SGI defines default Motif resources in /usr/lib/X11/schemes/Base/ ...but their purpose is a great mystery for me: in the comments it seems to imply that such resources are related to sgiMode, but, however, if you use them, you don't get sgiMode sizes and positions. For example, you get smaller pushbuttons, separations in menu entries are wrong, etc, etc... Almost none of those resources is actually used with such values when you enable sgiMode in an application. So, what are they used for? No idea.

BTW, I just updated the set again, with minor fixes: I was setting the XmLabel and XmLabelGadget margins to zero, but this was to compensate for wrong positions coming from changing highlightThickness globally, and these zero margins in labels were causing flickering in file dialogs, so it's obvious that SGI didn't set them to zero. I just removed the highlightThickness global modification, so the label margins are left with their default values, and the flickering in file dialogs is gone.