IUP/Motif - características

IUP - Portable User Interface

Motif Driver 

Driver for the X-Windows/Motif environment.

Environment Variables

QUIET

When this variable is set, IUP does not generate the message indicating the driver’s version when initializing.

DEBUG

This variable’s existence makes the driver operate in synchronous mode with the X server. This slows down all operations, but allows immediately detecting errors caused by X.

Exclusive Attributes

MOTIFVERSION (global)

Returns the version of the run time Motif.

TRUECOLORCANVAS (global)

Indicates if the display allows creating TrueColor (> 8bpp) windows, even if PseudoColor is the default. Returns "YES" or "NO".

AUTOREPEAT (global)

Turns on/off  ("YES" or "NO") the autorepeat of keyboard keys in the whole system - may be used as an optimization in high performance applications.

XDISPLAY (all)

Returns a Display*, indicating the control’s X display. It is a verification-only attribute, available after the control is mapped.

XWINDOW (all)

Returns a Window, indicating the control’s X window. It is a verification-only attribute, available after the control is mapped.

XSCREEN (all)

Returns a Screen*, indicating the control’s X screen. It is a verification-only attribute, available after the control is mapped.

MOTIF_FONT (all)

This attribute, as well as FONT, can be used to change a control’s font. Is should not be used, being specified only to keep compatibility. To change a control’s font, use FONT.

Differentiated Attributes

ENTERWINDOW_CB / LEAVEWINDOW_CB (all)

The same callback available for CANVAS can be used for other elements.

ICON (DIALOG)

This attribute’s value must be a string containing the name of the IUP image to be used as an icon when the dialog is minimized. The current window manager will determine how, or if, the icon will be displayed.

WID

This attribute returns a Widget which identifies the Intrinsics control. It is a verification-only attribute, available after the control is mapped.

CURSOR (all menus and submenus)

This attribute can be used in other elements as well as the canvas and dialog.

Window Manager Dependent Attributes

The attributes below can have different behaviors depending on the window manager controlling the display where the application is being viewed. They are typically attributes that control dialog visual characteristics, since these are drawn by the window manager.

MAXBOX (DIALOG) MINBOX (DIALOG)
MENUBOX
(DIALOG)
RESIZE
(DIALOG)
BORDER
(DIALOG)
ICON
(DIALOG)

Differentiated Functions

IupFlush

Does not always work. If there is an example sent by the X server which is not yet in the event queue, after a call to IupFlush the queue might not be empty.

Default Values – Resource Files

Some default values used by the driver, such as background color, foreground color and font, can be set by the user by means of a resource file called Iup. It must be in the user’s home or in a directory pointed to by the XAPPLRESDIR environment variable. Below you can see an example of this file’s contents:

*background: #ff0000
*foreground: #a0ff00
*fontList: -misc-fixed-bold-r-normal-*-13-*

The values used in the example above are the ones used by IUP if these resources are not defined.

Generating Applications

IUP/Motif is composed by two libraries: iupmot and iup. They use the Motif (Xm), Xtoolkit (Xt) and Xlib (X11) libraries. To link an application to IUP, use the following options in the linker call (in the same order):

-liup -lXm -lXmu -lXt -lX11 -lm

Though these are the minimum requirements, depending on the platform other libraries might be needed. Typically, they are X extensions (Xext), needed in SunOS, and Xpm, needed in Linux. They must be listed after Xt and before X11. For instance:

-liup -lXm -lXmu -lXt -lXpm -lXext -lX11 -lm

Usually these libraries are placed in default directories, being automatically located by the linker. When the linker warns you about a missing library, add their location directories with option -L. In Tecgraf, some machines require such option:

Padrão -L/usr/lib -I/usr/include
Linux -L/usr/X11R6/lib -I/usr/X11R6/include
IRIX -L/usr/lib32 -I/usr/include/X11
Solaris -L/usr/openwin/lib -I/usr/openwin/share/include/X11
AIX -I/usr/include/Motif2.1

In systems that support dynamic libraries, the library name is libiup.so. To force a link with static libraries in these systems, use option -static. In this case, the library name will be libiup.a.

Following are some makefile suggestions. All of them can be used in SunOS (Sun), IRIX (Silicon) and AIX (IBM) systems. For Linux, -lXpm must be added at the end of the SYSLIBS variable.

The available IUP binaries and the tests were done in the following systems:

  • Linux24    = Red Hat 7.3 (i686) / Kernel 2.4.18-27.7.x / gcc 2.95.3 / Motif 2.1.30
  • Linux24g3  = Red Hat Fedora (i686) / Kernel 2.4.22-1.2199 / gcc 3.3.2 / Motif 2.2.2
  • AIX43      = IBM AIX 4.3 / gcc 2.95.2 / Motif 2.1.0
  • IRIX65     = SGI IRIX 6.5 / gcc 3.0.4 / Motif 2.1.20
  • IRIX6465   = SGI IRIX 6.5 (64 bits OS, but libs are still 32 bits) / gcc 3.0.4 / Motif 1.2.4
  • IRIX6465cc = SGI IRIX 6.5 (") / cc MIPSpro 7.30 / Motif 1.2.4
  • SunOS57    = Sun Solaris 7 (sparc) / gcc 2.95.2 / Motif 2.1.0
  • SunOS58    = Sun Solaris 8 (sparc) / gcc 2.95.3 / Motif 2.1.0

Tips

  • During linking in the Solaris environment: Can not find libresolv.so.2

This error occurs if the system does not have an applied patch containing this library.

This library is important for all installations of Solaris 2.5 and 2.5.1 (SunOS 5.5 and 5.5.1, respectively). It is a correction of the DNS system, involving security.

The web address to get these patches is SunSolve’s http://sunsolve1.sun.com/sunsolve/pubpatches/patches.html. Select the Solaris version you wish (2.5 or 2.5.1 for Sparc) and download the patches 103667-09, 102980-17, 103279-03, 103708-02, or more recent for 2.5 (the number after the ‘-’ is the patch version, and the more recent number is the patch), or 103663-12, 103594-14, 103680-02 and 103686-02 for 2.5.1. All of them have a README file explaining installation, and groups have to be installed together.

  • TrueColor canvas

Whenever a canvas is created, one tries to create it with a TrueColor resolution Visual. This is not always possible, since it is subject to many conditions, such as hardware (graphics board) and the X server’s configuration.

The xdpyinfo program informs which Visuals are available in the X server where the display is being made, so that you can see if your X allows creating a canvas with a TrueColor Visual. In some platforms, however, the X server may not make a TrueColor Visual available, even though the graphics board is able to display it. In this case, restart the server with parameters that force this. Below is a table with such parameters to some systems where the IUP library has been tested. If the command does not work, or if it is not possible, then the graphics library really does not support 24 bpp.

System Execution Command
Linux startx --bpp 24
AIX (not necessary)
IRIX (not necessary)
Solaris (not necessary)

Since color requests are “always” successful in TrueColor/24bpp windows, we have minimized visualization problems for images that make use of complex color palettes (when there is a high color demand, not always all colors requested can be obtained). The IUP applications also coexist more “peacefully” with other applications and among themselves, since the colors used by TrueColor/24bpp windows do not use the colormap cells used by all applications.

  • XtAddCallback failed

When a warning about XtAddCallback appears during the application inicialization, and it aborts, this means that you are using a Motif with a different version than the Motif used to build IUP. Reinstall Motif or rebuils IUP using your Motif.