title: SDL2 get keymapped / "cooked" code for a keypress event?
body: <p>I'm trying to &quot;cook&quot; a modifier + keycode as received from SDL_KEYDOWN events, into what the combination represents in the current OS keymap.</p>
  <p>In SDL1, this was available in the keysym.unicode field, but this is gone in SDL2.</p>
  <p>Instead, you're supposed to listen to SDL_TEXTINPUT events for this, which does work, but the problem is they come <em>after</em> the corresponding SDL_KEYDOWN events, so if you have for example a hotkey that you use and want to react to, which could need to be a part of a composite key, you get into trouble.</p>
  <p>More specifically, I'm trying to react to the '/' press, in the current keymap, to open an admin command box in a game. But on my keymap, / is reached with Shift+7, and I'm already using 7 as a hotkey for other stuff and don't want to trig that other stuff in the Shift+7 case (but I can't know from the game that it's the particular Shift+7 which represents '/'!)</p>
  <p>In SDL2, I get these events in this order:</p>
  <ul>
  <li>SDL_KEYDOWN for L_SHIFT</li>
  <li>SDL_KEYDOWN for 7</li>
  <li>SDL_TEXTINPUT for '/'</li>
  </ul>
  <p>One workaround I was going to ask about is if there was a way to &quot;cook&quot; the &quot;L_SHIFT + '7'&quot; combination into '/' myself, this way I could check this immediately on the SDL_KEYDOWN for 7, before waiting for an SDL_TEXTINPUT event.</p>
  <p>In SDL1 on the other hand, I would get:</p>
  <ul>
  <li>SDL_KEYDOWN for L_SHIFT</li>
  <li>SDL_KEYDOWN for '7' with keysym.unicode field set to '/'</li>
  </ul>
  <p>which worked fine (and also worked then for keymaps that had '/' on a dedicated key).</p>