[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#255286: Meta has become alt?



On Wed, Sep 15, 2004 at 01:29:12AM +0200, Denis Barbier wrote:
> I am not an expert, know nothing about this spec and so read it.
> All I found is:
>   Clients should determine the meaning of a modifier bit from the
>   KeySyms being used to control it.
> My understanding is that from (x)emacs authors point of view, if
> mod4 is bound to Hyper and Super keysyms, client applications
> cannot guess what this modifier is for.
> But this quoted sentence is too vague, and can also be read as:
> "One cannot assume that mod1 is Alt or mod4 is Super, so client
>  applications should check the KeySym returned by the X server."
> The right Keysym can be chosen by applying the rules explained
> above, when xmodmap output was discussed.

Here are some clarifications:
 1. If a key is bound to several modifiers (say mod1 and mod4 contain
Super_L), then Super_L activates both modifiers, which is pretty
useless (and harmful).

 2. If different keys are bound to the same modifier (say Super_L and
Hyper_L to mod4), client applications cannot determine with core X
protocol if Super_L or Hyper_L was pressed/released when they receive
an event and mod4 is active.

With either scenario (1) or (2), emacs is unusable.  XKB configuration
can lead to (2) because of the so-called fake keys.  This is not a bug,
but a feature, XKB-aware applications can take advantage of them.
Any fix to let emacs away of (2) is better than the current situation,
and it is trivial: emacs should not accept to bind different keys to the
same modifier.  (Except for the Meta/Alt keys, see below)

Fixing (1) is less trivial, and normally XKB should never produce
such situations.  So I did not try to fix this uncommon situation
in order to have a smaller and easier to read patch.

<footnote dest="X maintainers">
But there is a problem with this paragraph, because when trying to
fix these modifier bugs in previous XFree86 releases, I added a
patch which can let XKB add Meta keys to mod1 and mod4 lists with
altwin:meta_win or altwin:left_meta_win options.
This patch was sent to http://bugzilla.xfree86.org/attachment.cgi?id=1197
and need to be reverted, I filed #1473 for that, and this issue is
discussed at https://listserv.bat.ru:8100/Lists/xkb/Message/232.html
Why Meta keys are added to both modifiers can easily be tracked down
with the small C file I sent in the previous post.
Hopefully next xlibs upload will fix this problem, so ignore it
in this bugreport.
</footnote>

The attached patch fixes (2) by stopping scanning modifiers list when
a modifier key is found,  In order to exactly reproduce the current
Alt/Meta mess, some more lines of code were needed.
I am not able to build emacs21 on my machine, so this patch was only
tested on the C file I sent in the previous post, but am pretty
confident that it works as expected.

As you can see, this patch is harmless, no working configuration can
be broken by it.  Can you please apply this patch so that emacs works
out of the box with recent XFree86 releases? 

Denis



Reply to: