• Aucun résultat trouvé

Default Button Bindings

The OSF /Motif 'Vindow Mana.ger C01nes with the following built-in button bindings.

Table 6·18. Built·ln Button Bindings

Locat.ion of Point.er Dehavior

Window menu button Pressing ImUon 1 displays t.he window menu. This behavior ca.n be modified by the yMenuButtonClick resollrce.

\i'Vindow menu button Double-clicking button 1 closes the window. This behavior can be modified by the yMenuButtonClick2 resource.

Minimize button Clicking but.t.on 1 minimizes the window.

Maximize button Clicking bllt.ton I maximizes t.he window.

Title bar Dra.gging butt.on 1 moves t.he window.

Window or icon Pressing button 1 gives it. keyboard focus.

Resize border Dragging butt.on 1 resizes t.he window.

Icon Clicking butt.on 1 displa.ys the icon window menu. This behavior can be modified by the iconClick resource.

Icon Double-clicking bllt.ton 1 normalizes the window.

Icon Pressing but.t.on 1 moves t.he icon.

These bindings are fixed-they cannot he replaced by other bindings.

However, you ca.n add to some of them (see "Modifying Button Bjndings and Their Functions.") For exa.mple, you can specify a.n addHional function for double-clicking button 1 in an icon, but the dOllblc click will also normalize the window.

MYm provides an additional default binding that can be deleted or replaced:

6-42 Managing Windows

Table 6·19. Additional Button Bindings

The binding can be removed or altered by deleting or editing the line that begins with <Btn1Down>. (In order for the editing to have an effect, the buttonBindings resource in the .Xdefaults file must be set to Def aul tButtonBindings, and you must restart the window manager.)

Modifying Button Bindings and Their Functions

You can modify the button bindings section of your .mwmrc file to suit your individual needs.

Button Binding Syntax

The syntax for button bindings is as follows:

Buttons ButtonBindingSetName

Each line identifies a certain button and operation, followed by the context in which the button operation is valid, followed by the function to be done. The following button binding contexts are recognized by the window manager:

root Operates the function when the button is activated in the root window.

Managing Windows 6·43

window

Operates the function when the button is activated on an icon.

Operates the function when the button is activated on a title bar.

Operates the function when the button is activated in a client window (excludes window frames).

Modifying Button Bindings To modify the button bindings:

1. Edit the "DefaultButtonBindings" section of the system.mwmrc (to make system-wide changes) or .mwmrc (to make changes to your local environment). The easiest way to modify button bindings is to change the default binding or to insert extra lines.

2. Set the buttonBindings resource in your . Xdefaul ts file to DefaultButtonBindings. This tells mwm to look in the

"DefaultButtonBindings" section of your .mwmrc file for a list of button bindings.

For example, Dub, the user who created his own "Graphics Project" menu in the previous section, may want to display the menu when he presses the

(Extend chad-button 3 sequence with the pointer in the root window. He would only need to insert one line in his . mwmrc file to make this happen.

The "DefaultButtonBindings" section of his .mwmrc file would look like the following:

root f.menu "Graphics Project"

In addition, Dub must have the following entry in his . Xdefaul ts file:

Mwm*buttonBindings: DefaultButtonBindings 6-44 Managing Windows

The new key binding will be in effect when Dub restarts the window manager.

Making a New Button Binding Set

Perhaps inserting a new button binding into the "DefaultButtonBindings"

set is not enough. Perhaps you need to make a cOlnplete new set of button bindings. To do this, use tlH~ "Defal1ltButtonBindings" section of your .mwmrc as a model. After you have created the new button binding set, use the

buttonBindings resource to tell the window manager about it. You do this by adding a line to your . Xdefaul ts file. The syn tax of the line is as follows:

Mwm*buttonBindings: iVewBultonJJirulingSet

This line directs the window ma.nager to use "New ButtonBindingSet" as the source of its button bindinginforma.tion. The button bindings are assumed to exist in the file named by the Mwm*configFile: resource, the default being

.mwmrc.

For example, suppose Dub, OlH graphics 11ser, wants to specify a

cOlnpletely new button binding set instea.d of inserting a line in the existing

"DefaultButtonBilldings" set. He needs to create a new button binding set, such as the following, modeled after the default set:

Buttons GraphicsButtonBindings {

<Btn2Down> root f.menu IIGraphics Project"

}

In his . Xdefaul ts file, Dub would then insert the fo1lowing line:

Mwm*buttonBindings: GraphicsButtonBindings

To displa.y his graphics 111en11, D 1I h needs on Iy to press button 2 when the pointer is on the root window.

Modifying Button Click Timing

The OSF /Motif vVindow Manager ha,s a.nother resource for controlling button behavior. This resonrce, doubleClickTime, sets the maxilnum time (in milliseconds) that can elapse between button clicks before a double-click becomes just "two clicks in arm\!." In other words, if two clicks occur in less than the lnaxilnlun tiIne, they are asstl med to be a double-click; if two clicks

Managing Windows 6-45

occur in a thne greater than the ma.ximum time, they are assumed to be two single clicks. The default is 500 (milliseconds).