• Aucun résultat trouvé

Declaring Resources

Dans le document the X Window System (Page 138-149)

The mwm client receives configuration information from three resource files:

• sys .Xdefaults in the system directory or .Xdefaults in your home directory.

Contains X resources.

• system.mwmrc in the system directory or .mwmrc in your home directory.

Menus, key bindings, and button bindings.

• app-defaul ts/Mwm in the system directory.

X resources for mwm only.

This file cannot be changed. However, you can copy information from that file, modify it, and then add it to your personal resource.

If you modify these files, you can use either method of specifying personal resources: changing the RESOURCE_MANAGER property or modifying the

. Xdefaul ts file. Both methods are covered in chapter 5.

The syntax you use differs depending on whether you want the resource to control an element or that element for a particular object.

The syntax for mwm resources is:

Mwm* [ { clientname clientclass}] * resource: value defaults

Use nothing between "M wm" and the resource name if you want the resource 7 applied to all clients for which you don't otherwise specify a value. Some

resources make sense only at this level, such as the focus policy ones. Use clientclass to apply the resource to a specific class of clients. Use clientname to apply the resource only to a specific instance of a client named using the client's name resource. Use defaults when you want the default value used.

7

For example, if you want the general appearance of the clients in your environment to be SteelBlue and Violet Red, but want your menus to be different, you could use the following lines in your personal resources.

Mwm*background:

Mwm*foreground:

Mwm*activeBackground:

Mwm*activeForeground:

Mwm*menu*background:

Mwm*menu*foreground:

SteelBlue VioletRed VioletRed SteelBlue SkyBlue White

Or, if you want to use your own happyface bitmap for hpterm windows and see a complete label whenever any icon is active, you would have the following lines in your personal resources:

Mwm*Hpterm*iconlmage: /users/yourusernarne/Bitmaps/face.bits Mwm*iconDecoration: label activelabel

Frames

You can control the general appearance of the window frames in your environment with your personal resources specifications.

Parts of a Window Frame

Three aspects of the general appearance of window frames are under your control.

Color Tile Font

The color of foreground, background; and top, bottom, and side shadows.

The mixture of foreground and background color that composes the pattern of the frame surface.

The style (including size) of the text characters in the title bar, menus, and icon labels.

Additionally, you can control what parts of the frame are displayed.

Prompt ---o;~~_

Pointer ~+----T

Resize Border

Maximize

Figure 7-1. Frame Elements

7

7

Customizing the Window Frames

You can specify what frame components you want to appear on windows:

• The clientDecoration resource enables you to choose just how much or how little "decoration" you want to put around each client .

• The transientDecoration resource enables you to choose just how much or how little decoration you want to put around each transient window. A transient window is a relatively short-lived window, for example, a dialog box.

You can still access the functionality of any decoration you remove by binding its functions to mouse buttons or to key presses, as explained in "Mouse Button Bindings" later in this chapter.

Table 7-1. Valid Window Frame Elements

Frame Element Description

all Include all frame elements (default value).

none Include no window frame elements.

±border Window border.

±maximize Maximize button (includes title bar).

±minimize Minimize button (includes title bar).

±none Include no window frame elements.

±resizeh Resize border handles (includes border).

±menu Window menu button (includes title bar).

±title Title bar.

You specify the clientDecoration and transientDecoration resources as a list of the frame elements. If the first element in the list is preceded by a plus (+) sign or has no sign preceding it, the window manager starts with no frame and assumes that the list contains those elements you want added. If the list begins with a minus (-) sign, the window manager starts with a complete

frame and assumes that the list contains elements you want removed from the frame.

For example, you may want a border with only a title bar and window menu button around a particular hpterm window started as hpterm -name hp850.

Mvm*hp850*clientDecoration: +menu

Or you could remove the title bar from all transient windows by adding the following line in your personal resources specification:

Mvm*transientDecoration: -title Coloring Window Frame Elements

You can use any of the standard XII colors listed in the rgb. txt file in your system directory to color frame elements. In addition, you can create your own colors using hexadecimal values (see "Color Resources" in chapter 5).

The following table lists the individual elements of inactive and active window frames, and the resources that control their color, for mvm.

The default settings provide a 3-D visual effect without you having to specify the exact colors for every frame element.

7

7

Table 7-2. Window Frames Resources for a Color Display

To color this ... Use this resource ... The default value is ...

Background of inactive background LightGrey

frames.

Left and upper bevel of topShadowColor Lightened background

inactive frames. color

Right and lower bevel of bottomShadowColor Darkened background color inactive frames.

Foreground (title bar text) foreground Darkened

of inactive frames. bottomShadowColor

Background of the active activeBackground CadetBlue frame.

Left and upper bevel of the activeTopShadowColor Lightened

active frame. act i veBackground color

Right and lower bevel of activeBottomShadowColor Darkened

the active frame. activeBackground color

Foreground (title bar text) activeForeground Darkened

of the active frame. activeBottomShadowColor

For example, the following lines in the . Xdef aul ts file in your home directory give the window manager frame a maroon foreground and a gray background.

The background color is used to generate colors for the top and bottom shadow elements so that a 3-D effect is achieved.

Mwm*foreground: Maroon Mwm*background: Gray

Tiling Window Frames With Pixmaps

A pixmap can be used to create shades of colors. Each pixmap is composed of tiles. A tile is a rectangle that provides a surface pattern or a visual texture by

"mixing" the foreground and background colors into a color pattern.

Table 7-3.

Tiling Window Frames with Window Manager Resources To tile this ... Use this resource ... The default for

color displays is ...

Background of inactive backgroundPixmap NULL

frames.

Right and lower bevels of bottomShadowPixmap NULL inactive frames.

Left and upper bevels of topShadowPixmap NULL inactive frames.

Background of the active activeBackgroundPixmap NULL frame.

Right and lower bevels of activeBottomShadowPixmap NULL the active frame.

Left and upper bevels of activeTopShadowPixmap NULL the active frame.

7

The following table lists the acceptable values for pixmap resources:

Table 7-4. The Values to Use for Tiling Window Frames

To tile an element this color ... Use this value ...

The foreground color. foreground

The background color. background

A mix of 25% foreground to 75% background. 25_foreground A mix of 50% foreground to 50% background. 50_foreground A mix of 75% foreground to 25% background. 75_foreground In horizontal lines alternating between the foreground and horizontaLtile background color.

In vertical lines alternating between the foreground and background verticaLtile color.

In diagonal lines slanting to the right alternating between the slant_right foreground and background color.

In diagonal lines slanting to the left alternating between the slant_left foreground and background color.

7

The following figure illustrates the valid tile values:

foreground background 25 foreground

horizontal tile I

- ----::--~ -

--~--~~- - - - -:--~

-vertical tile

'IIililllllllllllllllllllilllllllllllllllllllllllllll111111111111[i:

Figure 7-2. Valid Tile Values

MaHing Clients

A matte is a 3-D border just inside the window between client area and window frame.

The following table lists matte elements and the resources that control their color.

7

7

Table 7-5.

Coloring Window Frames with Window Manager Resources

To color this ... Use this resource ... The default value is ...

Width of matte matteWidth

o

(no matte)

Matte background. matteBackground mwm background Left and upper bevel of matteTopShadowColor Lightened

matte. matteBackground color.

Right and lower bevel of matteBottomShadowColor Darkened

matte. matteBackground color.

Matte foreground. matteForeground Darkened

matteBottonShadowColor.

Matte right and lower matteBottomShadowPixmap client bottom shadow color bevels.

Matte left and upper matteTopShadowPixmap client top shadow color bevels.

The values to use for tiling mattes are shown in Table 7-4.

For example, you could place a different matte around hpterm and xterm windows by including the following lines in your personal resources specifications:

Frame Resources For Monochrome Displays

If mwm determines that the monitor is monochrome, and no color resources are specified for frame elements, mwm uses defaults appropriate for monochrome displays. Mwm*background and Mwm*activeBackground are set to White. The following table lists the frame elements, resources, and defaults for monochrome monitors.

Table 7-6.

Window Frame Resource Values for Monochrome Monitors

The background is ... For this resource ... The default value is ...

White topShadowColor White

White bottomShadowColor Black

White foreground Black

White topShadowPixmap foreground

White act iveBackgroundP ixmap foreground White activeTopShowdowPixmap 50_foreground

The sys. Xdefaul ts file contains a set of entries that provides a more

attractive window shading for monochrome displays. These entries start with mwm_bw, and require that you start mwm with the name mwm_bw. To do this, edit the following line in .xllstart:

mwm t #Starts the mwm window manager to read:

mwm -name mwm_bw t #Starts the mwm window manager You must restart Xll in order for this change to take effect.

When you start the window manager with a new name, it will no longer see

resources of the form mwm*resource. It will see the class resources Mwm*resource. 7

7

Dans le document the X Window System (Page 138-149)