This patch implements a workaround for the problem
that some users have when another application installs
an invalid Motif default virtual key binding set.
An example is the flash player plugin of netscape 6:
it installs a binding with multiple entries per
virtual key. When it is started before NEdit,
chances are that PageUp, PageDown, the arrow keys,
Home, and End stop working (especially with
OpenMotif). Mainly RedHat 7.2 users seem to be
affected by this problem.
The patch does the following by default:
- Upon the first creation of a window, it
checks whether any bindings are attached to the
root window, and if so, whether they are valid.
- If there are no bindings, or when they are
seemingly valid (no duplicates), nothing happens.
- If the bindings turn out to be invalid, they
are overridden by default bindings (provided by
the Motif library), and when the window is
completed the original bindings are attached to
the root window again, such that no other
applications are affected. This happens only
for the first window created.
This default behavior can be changed by a resource:
It can be set to "Never", "Auto" (default), or
"Always", so that the workaround can be disabled
or enforced when the automatic detection doesn't
work, or causes any unforeseen problems.
Note that "Always" means "always if bindings have
already been attached to the root window", so if
no bindings are present, nothing is done in all three
There is one issue, though: the workaround makes
use of an undocumented Motif function:
extern int _XmVirtKeysLoadFallbackBindings(Display
*Dsp, String *Bindings);
In Lesstif, it is documented as being undocumented
(but safe to use).
I have tested it on several platforms:
and it doesn't seem to give any problems.
Any comments ?
PS: This emulates the effect of starting the flash
xprop -root -f _MOTIF_DEFAULT_BINDINGS 8s -set \ _MOTIF_DEFAULT_BINDINGS\ "osfActivate:<Key>KP_Enter\ osfBackSpace:<Key>BackSpace\ osfCancel:<Key>Escape\ osfCopy:Ctrl<Key>Insert\ osfCut:Shift<Key>Delete\ osfDelete:<Key>Delete\ osfBeginLine:<Key>Home\ osfBeginLine:<Key>KP_Home\ osfEndLine:<Key>End\ osfEndLine:<Key>KP_End\ osfInsert:<Key>Insert\ osfLeft:<Key>Left\ osfLeft:<Key>KP_Left\ osfMenu:Shift<Key>F10\ osfMenuBar:<Key>F10\ osfPageDown:<Key>Next\ osfPageDown:<Key>KP_Page_Down\ osfPageLeft:Ctrl<Key>Prior\ osfPageRight:Ctrl<Key>Next\ osfPageUp:<Key>Prior\ osfPageUp:<Key>KP_Page_Up\ osfPaste:Shift<Key>Insert\ osfRight:<Key>Right\ osfRight:<Key>KP_Right\ osfUp:<Key>Up\ osfUp:<Key>KP_Up\ osfDown:<Key>Down\ osfDown:<Key>KP_Down"