The SCO OpenServer system is designed to run on a wide variety of hardware platforms, with resolutions ranging from 640-by-480 pixels to beyond 1280-by-1024 pixels. Visual resources defined for a specific display resolution can produce inappropriately sized, unpleasant, or even illegible results when your application is displayed at a different resolution.
You may specify a different set of visual resources for each display resolution or type with an ODR (display resources) file. In an ODR file, standard #if, #elif, and #else preprocessor directives are used to test the values of certain display attributes, such as WIDTH. For example, the following tests the WIDTH of the display (in pixels) and specifies font sizes accordingly.
#if WIDTH < 800 TypicalApp*create_button.FontList -*-helvetica-bold-r-*--10-*-p-* TypicalApp*delete_button.FontList -*-helvetica-bold-r-*--10-*-p-* #elif WIDTH < 1024 TypicalApp*create_button.FontList -*-helvetica-bold-r-*--12-*-p-* TypicalApp*delete_button.FontList -*-helvetica-bold-r-*--12-*-p-* #elif WIDTH < 1280 TypicalApp*create_button.FontList -*-helvetica-bold-r-*--14-*-p-* TypicalApp*delete_button.FontList -*-helvetica-bold-r-*--14-*-p-* #else TypicalApp*create_button.FontList -*-helvetica-bold-r-*--18-*-p-* TypicalApp*delete_button.FontList -*-helvetica-bold-r-*--18-*-p-* #endif
At the beginning of a session, the session manager uses xrdb, the X resource database utility, to check display attributes and resolve the conditional statements in your ODR file. In this way, visual resources appropriate to each display are loaded into the RESOURCE_MANAGER property of the root window.
Although you may define resources for as many display resolutions
as you like, we recommend that you at least support the following four
resolutions (WIDTH x HEIGHT in pixels):
640 x 480 (VGA)
800 x 600 (SVGA)
1024 x 768 (SVGA)
1280 x 1024 (high-resolution)
Most applications only need to specify resolution-dependent resources in ODR files, but you can test for any display attribute recognized by the xrdb utility, shown in ``Display attribute symbols''. If your application does not use the color API, you may want to define color resources in your ODR file.
You do not need to define any of the default system color or font resources unless you want to override them. The default font and color resources are defined in /usr/lib/X11/sco/startup/Fonts and /usr/lib/X11/sco/startup/Colors.
For more about graphical resources, see the Graphical Environment Guide. Remember that your resource definitions only affect the content of the window in which your application is running. The window's frame and decorations are controlled by the window manager's resources.
To specify resolution-dependent resources:
Because the ODR files for all installed applications are loaded at the beginning of a session, only define display-dependent resources in ODR files. Define other resources in an app-defaults file, as usual (for more about app-defaults files, see the Graphical Environment Guide.
Define all of your display-dependent resources in a single ODR file. Choose a name for your ODR file that is unlikely to be duplicated by other programs (typically your application's class name). Within this file, organize resources according to the type of display with which they are to be used. Use standard #if, #elif, and #else preprocessor directives and xrdb display attribute symbols to conditionally specify resources. We use the WIDTH (screen width in pixels) symbol to define resolution-dependent resources.
Display attribute symbols
|WIDTH||screen width in pixels|
|HEIGHT||screen height in pixels|
|X_RESOLUTION||horizontal screen resolution in pixels/meter|
|Y_RESOLUTION||vertical screen resolution in pixels/meter|
|CLASS||GrayScale, PseudoColor, TrueColor, DirectColor, StaticColor, or StaticGray|
|COLOR||defined only if CLASS = PseudoColor, TrueColor, DirectColor, or StaticColor|
|PLANES||display depth in bit planes; this value defines the number of available colors|
|BITS_PER_PLANE||number of significant bits in an RGB color specification; usually unrelated to PLANES|
To avoid conflicts with other applications' ODR resources loaded at the same time, begin the name of each resource in your ODR file with your application's class. For example, an application that displays a calendar might include the following in its ODR file:
#if WIDTH < 800 Calendar.main.width: 300 Calendar.main.height: 200 #elif WIDTH < 1024 Calendar.main.width: 400 Calendar.main.height: 300 #elif WIDTH < 1280 Calendar.main.width: 500 Calendar.main.height: 400 #else Calendar.main.width: 700 Calendar.main.height: 500 #endif
Do this in your installation script.
At the start of a session, the session manager uses the xrdb utility to process your ODR file and load the appropriate resources.
To ensure that your application will always display, even if it is run without the session manager (and, therefore, without your ODR file loaded), define default resources in your app-defaults file. Include resource definitions for a 1024-by-768-pixel display (the resolution most widely used by the SCO OpenServer system) from your ODR file. Also include the default font resource definitions from /usr/lib/X11/sco/startup/Fonts and the default color resource definitions from /usr/lib/X11/sco/startup/Colors. Place these default definitions before any overriding definitions of your own. Name your app-defaults file with your application's class name, and install it in the /usr/lib/X11/app-defaults directory.
When they are loaded, your ODR file resource definitions take precedence over the defaults defined in your app-defaults file.