next up previous contents index
Next: 9. Inside XmStrings Up: 8. When the Keyboard Previous: 4. Managing the Virtual   Contents   Index

5. The xmbind Client

The current virtual bindings are stored in one of two possible properties on the root window of screen #0. There can be only one set of active virtual bindings at the same time on a given display as there exists only one keyboard per display. Therefore the current bindings are always stored in a property of the root window of screen #0. Please note that they are not attached to the root window of the default screen, as the default screen can be any screen of a given display and may even change from application to application (see figure [*]). The storage for the current virtual bindings is provided by one of the following properties (both of type XA_STRING):


\begin{itemlist}
\item The property \code{\_MOTIF\_DEFAULT\_BINDINGS} (if existe...
...e or
from \code{xmbind.alias} (available in several good places).
\end{itemlist}

If none of the two properties exist, LESSTIF's startup-code first tries to find user-specific bindings and if it succeeds, it sticks them to the _MOTIF_BINDINGS property. Otherwise the starup-code figures out the default virtual bindings (according to the display) and loads them into the _MOTIF_DEFAULT_BINDINGS property. In every case, after starting a LESSTIF application the root window of screen #0 contains a property specifying the current virtual bindings.

The xmbind client can be used to change or setup the properties related to the virtual bindings. This client is remarkable simple, as most of the functionality needed is already laid down in the LESSTIF library (mostly in the form of ``undocumented'' functions). Following is the pseudo-code of xmbind (the source resides in (LESSTIF_ROOT)/clients/xmbind/xmbind.c):


    if (°user specified a file on the command line°) {
        °delete the° _MOTIF_DEFAULT_BINDINGS °property°
        °load the file into the° _MOTIF_BINDINGS °property°
    } else {
        if (°there is a° .motifbind °file°) {
            °delete the° _MOTIF_DEFAULT_BINDINGS °property°
            °load the file into the° _MOTIF_BINDINGS °property°
        } else {
            °delete the° _MOTIF_BINDINGS °property°
            °load fallback bindings into the ° _MOTIF_DEFAULT_BINDINGS °property°
        }
    }
    °flush the connection to the display and terminate°

Figure: Displays, Screens and the Virtual Bindings.
\begin{figure}
\centerline{\epsfig{file=Bindings.eps,scale=1.09}}\end{figure}


next up previous contents index
Next: 9. Inside XmStrings Up: 8. When the Keyboard Previous: 4. Managing the Virtual   Contents   Index
Danny Backx
2000-12-13