[pygtk] how to map modifier keys to bits in modifier masks?

Skip Montanaro skip at pobox.com
Mon Oct 18 23:22:37 WST 2004


In the docs for gtk.gdk.Event the description of MOD1_MASK reads:

    gtk.gdk.MOD1_MASK   The fourth modifier key (it depends on the modifier
                        mapping of the X server which key is interpreted as
                        this modifier, but normally it is the Alt key).

How do I determine the mapping at run-time (without human intervention)?  I
wrote a trivial PyGTK script that picks apart and prints the modifier mask
for various events, but I can't have each user run that and build a little
database for me.  On my particular setup (Solaris Intel running Xi Graphics
X server v. 11) NumLock is actually MOD2 while Left Alt is MOD4 and Right
Alt appears to be unassigned.  Other people here at work run various other
combinations of OS and X server software, so there is likely to be some
variation.

Thanks,

-- 
Skip Montanaro
skip at mojam.com
http://www.mojam.com/


More information about the pygtk mailing list