Closed SpiritQuaddicted closed 10 years ago
It actually says that for pretty all keys apart from the F# keys, capslock, pause, scrolllock, winkey and similar ones.
"bind ^ toggleconsole" works perfectly fine.
Hmm. The "key is reserved" protection is kind of complicated. As a first step here's a look at what it is doing... no solution proposed yet.
It references two things: the consolekeys array defined in Key_Init in keys.c, and the M_IsReservedKey function in menu.c.
The consolekeys array seems to be defining any key that can affect the console text while the console is down; M_IsReservedKey appears to be checking for keys that could possibly be used in menus. I think the intent of the "reserved key" protection is to make sure that you can do things like open the console, quicksave, take screenshots, etc. without horking up a current on-screen menu or the state of a pulled-down console.
When you're using the keybinding menu for "Gameplay controls" or "Other controls", the keybinding request eventually comes through the M_Keys_Key function. (If you do a bind manually it circumvents this.) For the "Other controls" menu, this function does a special check and rejects any keys that are in consolekeys or that cause M_IsReservedKey to return true.
M_IsReservedKey (but not consolekeys) also appears to be checked whenever you set the key_menuclose or key_menuprev cvar, whether manually or through the menu.
P.S. Here's a fun consequence of checking against consolekeys for any binding in the "Other controls" menu: if you clear your console key binding, you can't rebind it back to the original key without manually editing the config file.
This is probably next on the list of "most important things to fix"? At least among the things I have a shot at understanding.
One thing we could do is set more keys (like the backtick key) to false in the consolekeys array. In fact there are already a couple of lines there for setting backtick and tilde to false, but they're commented out. I wonder why.
Of course in your case you'd prefer to have the caret character un-reserved, and that kind of throws a spanner into the pattern of "reserve any printable characters that people might legitimately want to type into the console (or some menu box)". Maybe we should get rid of the idea of reserved keys altogether.
So, that pull request implements one possible solution. Let me know what you think.
Seems like a reasonable fix to me. Thanks!
Console toggle by ^ key on german layout does not work out of the box and the user cannot re-bind it through the menu as it says that key is "protected"