Bug 492529 - Openmotif accelerators XmNaccelerator do not work with CapsLock/ScrollLock/NumLock modifiers
Summary: Openmotif accelerators XmNaccelerator do not work with CapsLock/ScrollLock/Nu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: openmotif
Version: 5.2
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Thomas Woerner
QA Contact: Filip Holec
URL:
Whiteboard:
Depends On:
Blocks: 569908
TreeView+ depends on / blocked
 
Reported: 2009-03-27 09:19 UTC by Olivier Fourdan
Modified: 2018-10-27 14:24 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-01 00:32:33 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1355 0 normal SHIPPED_LIVE openmotif bug fix and enhancement update 2013-09-30 21:12:33 UTC

Description Olivier Fourdan 2009-03-27 09:19:24 UTC
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.

Comment 1 Olivier Fourdan 2009-03-27 09:29:00 UTC
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 09:33:44 UTC
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 11:47:33 UTC
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 11:51:19 UTC
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 17:16:42 UTC
This patch has been accepted upstream. (motifzone bz#345)

Comment 30 errata-xmlrpc 2013-10-01 00:32:33 UTC
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


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