HPlogo Using the X Window System > Chapter 7 The Window Manager

Mouse Button Bindings

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

The window manager recognizes the following button operations:

Press

Holding down a mouse button.

Click

Pressing and releasing a mouse button.

Double-click

Pressing and releasing a mouse button twice in rapid succession.

Drag

Pressing a mouse button and moving the pointer (and mouse device).

You associate a button operation with a window management function using a button binding. A button binding is a command line you put in the .mwmrc file that associates a button operation with a window manager function.

Default Button Bindings

The OSF/Motif Window Manager comes with the following built-in button bindings.

Table 7-18 Built-In Button Bindings

Location of Pointer Behavior
Window menu button Pressing button 1 displays the window menu. This behavior can be modified by the wMenuButtonClick resource.
Window menu button Double-clicking button 1 closes the window. This behavior can be modified by the wMenuButtonClick2 resource.
Minimize button Clicking button 1 minimizes the window.
Maximize button Clicking button 1 maximizes the window.
Title bar Dragging button 1 moves the window.
Window or icon Pressing button 1 gives it keyboard focus.
Resize border Dragging button 1 resizes the window.
Icon Clicking button 1 displays the icon window menu. This behavior can be modified by the iconClick resource.
Icon Double-clicking button 1 normalizes the window.
Icon Pressing button 1 moves the icon.

 

These bindings are fixed—they cannot be replaced by other bindings. However, you can add to some of them (see "Modifying Button Bindings and Their Functions.") For example, you can specify an additional function for double-clicking button 1 in an icon, but the double click will also normalize the window.

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

Table 7-19 Additional Button Bindings

Locaton of Pointer Behavior
Icon or Frame Pressing button 1 raises the window or icon.

 

This binding is listed in the following section of the .mwmrc file.

   Buttons DefaultButtonBindings

   {

    <Btn1Down>  icon|frame  f.raise

   }

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 must be set to DefaultButtonBindings, 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

   {

      button   context|context  function  [argument]

      button   context|context  function  [argument]

      button   context|context  function  [argument]

   }

The following button binding contexts are recognized by the window manager:

root

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

window

Operates the function when the button is activated in a client window or window frame.

frame

Operates the function when the button is activated on a window frame.

icon

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

title

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

app

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

Modifying Button Bindings

Button bindings can be modified by:

  • Editing the DefaultButtonBindings section of .mwmrc.

  • Making a new button binding set.

To create a new button binding set:

  1. Edit the .mwmrc file to include a new key binding set with a unique name.

  2. Set the buttonBindings resource in your .Xdefaults file to the new name.

Modifying Button Click Timing

The OSF/Motif Window Manager has another resource for controlling button behavior. This resource, doubleClickTime, sets the maximum time (in milliseconds) that can elapse between button clicks before a double-click becomes just "two clicks in a row." In other words, if two clicks occur in less than the maximum time, they are assumed to be a double-click; if two clicks occur in a time greater than the maximum time, they are assumed to be two single clicks. The default is 500 (milliseconds).

© 1995 Hewlett-Packard Development Company, L.P.