Created attachment 336982 [details] Simple reproducer Description of problem: Motif (and subsequently Openmotif) were never ported to support X11R6 modifiers scheme. As a result, keyboard accelerators do not work if on of the Lock keys (CapsLock/ScrollLock/NumLock) is engaged. Version-Release number of selected component (if applicable): openmotif-2.3.1-2.el5 How reproducible: 100% reproducible Steps to Reproduce: 1. Save and build the attached reproducer $ cc -o accel accel.c -L/usr/lib -lXm -lXt -lX11 2. Run the reproducer, make sure no lock key is engaged and press Ctrl+W $ ./accel => The window closes as expected 2. Rerun the reproducer, now press NumLock key and press Ctrl+W $ ./accel => The window does not close Actual results: The accelerator does not work if CapsLock/ScrollLock/NumLock is engaged Expected results: The accelerator works independently of any CapsLock/ScrollLock/NumLock modifier Additional info: This is apparently a 14 years old flaw in Motif that was first reported in this bug upstream: http://bugs.motifzone.net/long_list.cgi?buglist=345 Proposed patch to follow.
Created attachment 336985 [details] Proposed patch For the accelerators to work, we need to filter the state of the KeyPress event with the appropriate modifier mask. But the mask depends on the actual modifiers mapping, so this needs to be determined first, that's the purpose of the InitModifiers() function in the patch. Once the appropriate modifier mask is known, all that needs to be done is to use that mask prior to compare the state of the modifiers in the event and the expected modifiers in XmMatchKeyEvent() in lib/Xm/MapEvents.c
Please also note that some Motif applications implement workarounds for that issue in Motif, like NEdit since 5.2 that has a mechanism to add the required grabs on all combinations of modifiers mask (that's in NEdit-5.5/util/misc.c) AFAICT, the proposed fix in Openmotif does not break NEdit workaround, as the event will be processed either by Openmotif or by the additional grab in NEdit.
Created attachment 341911 [details] Reworked patch The previous patch was just partially working, because the activa grabs were not modifed to also grab the various problematic modifiers combinations. This new version adds the missing bits (ir XtGrabKey/XtUngrabKey of key + all modifiers combinations) and also refactor the added code a bit to be cleaner and hopefully more in line with upstream coding style.
Created attachment 341912 [details] Another reproducer Another reproducer provided by the customer, that demonstrates the need for the updated patch (ie, the new reworked patch also fixes the problem in the case of that new reproducer)
This patch has been accepted upstream. (motifzone bz#345)
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-1355.html