I'm using Xlib for a project, and I'm trying to get the KeySym relative to a pressed key.
I've got the KeyCode relative to the pressed key, keyboard modifier开发者_如何转开发s and keyboard indicators. I'm referring to this page to understand how to retrieve the correct key, but it must be out of date or something, because my X doesn't behave like that page says.
I've got some questions:
What is MODE SWITCH? How can I see what key is my MODE SWITCH and how can I set it? (via Xlib functions or via a command, it's the same).
That page says that the first 4 KeySyms associated to a KeyCode (found with
XGetKeyboardMapping
, or shown byxmodmap -pk
command) are divided into two groups. MODE SWITCH switches between groups, and within a group the first or the second KeySym is chosen according to modifiers (ie, shift key) or indicators (ie, caps lock). But on my X I can see that if shift is pressed, I switch to the third KeySym, not the second one.On many european layouts AltGr key is bound to KeySym
XS_ISO_Level3_Shift
, which doesn't belong to any keyboard modifier (ie,shift
,lock
,control
,mod1
,mod2
,mod3
,mod4
andmod5
). When suchXS_ISO_Level3_Shift
is pressed, the fifth KeySym associated to the KeyCode is chosen. Why? Where can I found some info about thisXS_ISO_Level3_Shift
and about other keysyms that are actually used, but not documented on Xlib manuals?
It looks like the page you're reading predates Xkb - I'd guess that content is 10-15 years old at least.
See: http://www.xfree86.org/current/XKBproto.pdf
"xmodmap -pm" will show you the modifier keys such as mode switch.
With Xkb, the behavior of basically everything is configurable, I believe. Start looking at /usr/share/X11/xkb/ for example. I don't know a lot about it but hopefully looking at Xkb instead of old docs will get you pointed in the right direction.
Tronche's manual is incomplete. I found more info about keyboard functions in:
1. xlib.pdf
2. xlib html manual at static.cray-cyber.org. This doc is hidden and a bit broken. Links are typed in lowercase, but the actual documents are in uppercase. After correcting the urls in browser it's readable.
PDF is complete I guess. I don't know if [2] is complete too, but for example the chapter 16.2 (sorry, I can't give a link cause my link limit is exceeded) is far longer than in Tronche's doc.
I'm a beginner in understanding xlib, that's what I managed to google out today.
精彩评论