Subject: I believe this is an X server bug

From: Simon Tatham <[email-masked]>
Date: Thu, 24 Jul 2014 15:12:48 +0100

Hi,

I found this bug report a few months ago when I was looking to see if
anyone had had the same problem as me. I too found that if VMware
Player had input focus when emacs started up, then emacs would never
recognise the Alt key.

Debugging with xtruss suggested that the reason for this was that
emacs queried the modifier map at startup, found it empty, and
thereafter listened for MappingNotify in order to know when to reload
the mod map but for some reason it never received any MappingNotify
events. (But it did receive the similar XkbMapNotify when vmware lost
or gained focus.)

That was on Ubuntu 10.04. The machine where I was seeing the problem
has recently been upgraded to 12.04, and now the problem has stopped
happening - on the same version of emacs. Debugging with xtruss shows
that now emacs _is_ receiving MappingNotify, suggesting that the X
server has changed its behaviour.

I suspect, in fact, that the following X.Org commit is the fix:

  http://cgit.freedesktop.org/xorg/xserver/commit/?id=3231962db826f5efd431596a309c96e907a191d1

which appeared in xorg-server 1.11, which would indeed be consistent
with me having this problem in Ubuntu 10.04 but not 12.04 (which use
xorg-server versions 1.7.6 and 1.11.4 respectively).

So if anyone else still has this problem, it might be worth letting
them know to check the version of their X server.

Hope this is helpful!

Cheers,
Simon
-- 
import hashlib; print (lambda p,q,g,y,r,s,m: m if (lambda w:(pow(g,int(hashlib.
 sha1(m).hexdigest(),16)*w%q,p)*pow(y,r*w%q,p)%p)%q)(pow(s,q-2,q))==r else "!"
 )(0xb80b5dacabab6145, 0xf70027d345023, 0x7643bc4018957897, 0x11c2e5d9951130c9,
 0xa54d9cbe4e8ab, 0x746c50eaa1910, "Simon Tatham <[email-masked]>")