VIRTUAL KEY/BUTTON(3W) — OLIT
SYNOPSIS
#include <Intrinsic.h>
#include <OpenLook.h>
char ∗OlConvertVirtualTranslation(virtual_translation)
char ∗virtual_translation;
DESCRIPTION
Converts Virtual Translations into Standard Translations
OlConvertVirtualTranslation() takes a virtual translation string as input and returns a standard X Toolkit Intrinsic’s translation string. The function parses the input string replacing any virtual key or button expressions with their real representation(s). A virtual translation string has the same format as a standard X Toolkit Intrinsics translation string, except that virtual expressions can appear as modifiers or event types. (However, a virtual expression cannot appear as an event type detail.)
Reference:
See "Appendix A" in the X Toolkit Intrinsics—C Language Interface, X Window System, X Version 11, Release 2, for more information on the translation string.
Virtual Expressions
Virtual expressions are key or mouse button names that are independent of any physical mapping of the keyboard or mouse buttons. For instance, MENU (which in this document refers to the mouse button used to pop up menus) has the virtual expression menuBtn in a virtual translation. If the end user has assigned mouse button three to be MENU, then the OlConvertVirtualTranslation() routine would convert a virtual translation that contains the expression menuBtn into a standard translation containing the expression Button3.
The following is the list of virtual expressions for the various keys and mouse buttons defined in the OPEN LOOK user interface. The left column gives the name used in this document. Name Virtual Expression
ADJUST adjustBtn
CANCEL cancelBtn
CONSTRAIN constrainBtn
COPY copyKey
CUT cutKey
DUPLICATE duplicateBtn
HELP helpKey
MENU menuBtn MENUDEFAULT menuDefaultBtn
NEXTFIELD nextFieldKey
PAN panBtn
PASTE pasteKey
PREVFIELD prevFieldKey
PROPERTY propertiesKey
SELECT selectBtn
STOP stopKey
UNDO undoKey
The following example illustrates a virtual translation that contains three productions. (The Message production does not involve any virtual translations but is included for illustration.)
" ! selectBtn <selectBtnUp>: notify() \n
<Message>: checkClientMessage() \n
! <copyKeyDown>: copyToClipboard()"
Space Allocated Only If Necessary
If the input string does not contain any virtual expressions, the original string is returned. If the input string contains at least one valid virtual production, the function allocates memory for the returned string. The application is responsible for checking this difference and freeing the allocated memory, if appropriate. Invalid Productions Dropped
If the input string contains a valid virtual production, any invalid virtual productions are not included in the returned string. If the input string contains no virtual productions, error checking is not done.
Sun Release 4.1 — Last change: 1/8/90