Chapter 15 Extended Stream Input Facilities

15.3 Gestures and Gesture Names

A gesture is some sort of input action by the user, such as typing a character or clicking a pointer button. A keyboard gesture refers to those gestures that are input by typing something on the keyboard. A pointer gesture refers to those gestures that are input by doing something with the pointer, such as clicking a button.

A gesture name is a symbol that gives a name to a set of similar gestures. Gesture names are used in order to provide a level of abstraction above raw device events; greater portability can be achieved by avoiding referring directly to platform-dependent constructs, such as character objects that refer to a particular key on the keyboard. For example, the :complete gesture is used to name the gesture that causes the complete-input complete the current input string; on Genera, this may correspond to theCOMPLETE key on the keyboard (which generates a#\Complete character), but on a Unix workstation, it may correspond toTAB or some other key. Another example is :select, which is commonly used to indicate a left button click on the pointer.

Note that gesture names participate in a one-to-many mapping, that is, a single gesture name can name a group of physical gestures. For example, an :edit might include both a pointer button click and a key press.

CLIM uses event objects to represent user gestures. Some of the more common events are those of the class pointer-button-event. Event objects store the sheet associated with the event, a timestamp, and the modifier key state (a quantity that indicates which modifier keys were held down on the keyboard at the time the event occurred). Pointer button event objects also store the pointer object, the button that was clicked on the pointer, the window the pointer was over, and the x and y position within that window. Keyboard gestures store the key name.

In some contexts, the object used to represent a user gesture is referred to as an gesture object. An gesture object might be exactly the same as an event object, or might contain less information. For example, for a keyboard gesture that corresponds to a standard printing character, it may be enough to represent the gesture object as a character.

define-gesture-name [Macro]

Arguments:
name type gesture-spec&key (unique t)
Summary:
Defines a new gesture named by the symbol name. It expands into a call to add-gesture-name.

type is the type of gesture being created, and is either :keyboard or :pointer-button. gesture-spec specifies the physical gesture that corresponds to the named gesture; its syntax depends on the value of type.

If unique is t (the default), all old gestures named by name are removed.

None of the arguments to define-gesture-name are evaluated.

add-gesture-name [Function]
Arguments:
name type gesture-spec&key unique
Summary:
Adds a gesture named by the symbol name to the set of gesture names. type and gesture-spec are as for define-gesture-name.

If unique is t, all old gestures named by name are removed. unique defaults to nil.

As an example, the :edit gesture name could be defined as follows using define-gesture-name:

        (define-gesture-name :edit :pointer-button (:left :meta))
        (define-gesture-name :edit :keyboard (#\E :control)) 
delete-gesture-name [Function]
Arguments:
name
Summary:
Removes the gesture named by the symbol name.

CLIM provides a standard set of gesture names that correspond to a common set of gestures. Here are the required, standard keyboard gesture names:

Here are the required, standard pointer gesture names:


CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker