Bug 492529 - Openmotif accelerators XmNaccelerator do not work with CapsLock/ScrollLock/NumLock modifiers
Openmotif accelerators XmNaccelerator do not work with CapsLock/ScrollLock/Nu...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: openmotif (Show other bugs)
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Thomas Woerner
Filip Holec
: Patch, ZStream
Depends On:
Blocks: 569908
  Show dependency treegraph
Reported: 2009-03-27 05:19 EDT by Olivier Fourdan
Modified: 2016-04-18 06:20 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-30 20:32:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Simple reproducer (1.50 KB, text/plain)
2009-03-27 05:19 EDT, Olivier Fourdan
no flags Details
Proposed patch (3.24 KB, patch)
2009-03-27 05:29 EDT, Olivier Fourdan
no flags Details | Diff
Reworked patch (7.41 KB, patch)
2009-04-30 07:47 EDT, Olivier Fourdan
no flags Details | Diff
Another reproducer (3.24 KB, text/plain)
2009-04-30 07:51 EDT, Olivier Fourdan
no flags Details

  None (edit)
Description Olivier Fourdan 2009-03-27 05:19:24 EDT
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):


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:


Proposed patch to follow.
Comment 1 Olivier Fourdan 2009-03-27 05:29:00 EDT
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
Comment 2 Olivier Fourdan 2009-03-27 05:33:44 EDT
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.
Comment 4 Olivier Fourdan 2009-04-30 07:47:33 EDT
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.
Comment 5 Olivier Fourdan 2009-04-30 07:51:19 EDT
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)
Comment 11 Thomas Woerner 2010-02-12 12:16:42 EST
This patch has been accepted upstream. (motifzone bz#345)
Comment 30 errata-xmlrpc 2013-09-30 20:32:33 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.