title: X11 KeySyms: Switch mode, KeySym groups and XK_ISO_Level3_Shift
body: <p>I'm using Xlib for a project, and I'm trying to get the KeySym relative to a pressed key.</p>
  
  <p>I've got the KeyCode relative to the pressed key, keyboard modifiers and keyboard indicators. I'm referring to <a href="http://tronche.com/gui/x/xlib/input/keyboard-encoding.html" rel="nofollow">this page</a> 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.</p>
  
  <p>I've got some questions:</p>
  
  <ol>
  <li><p>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).</p></li>
  <li><p>That page says that the first 4 KeySyms associated to a KeyCode (found with <code>XGetKeyboardMapping</code>, or shown by <code>xmodmap -pk</code> 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.</p></li>
  <li><p>On many european layouts AltGr key is bound to KeySym <code>XS_ISO_Level3_Shift</code>, which doesn't belong to any keyboard modifier (ie, <code>shift</code>, <code>lock</code>, <code>control</code>, <code>mod1</code>, <code>mod2</code>, <code>mod3</code>, <code>mod4</code> and <code>mod5</code>). When such <code>XS_ISO_Level3_Shift</code> is pressed, the fifth KeySym associated to the KeyCode is chosen. Why? Where can I found some info about this <code>XS_ISO_Level3_Shift</code> and about other keysyms that are actually used, but not documented on Xlib manuals?</p></li>
  </ol>