]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix for Blub\0's strange change to toggleconsole handling which broke
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 23 Jul 2008 03:53:37 +0000 (03:53 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 23 Jul 2008 03:53:37 +0000 (03:53 +0000)
the con_closeontoggleconsole feature (which is what allows you to close
the console with the same key that opens it, rather than using escape)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8421 d7cf8633-e32d-0410-b094-e92efae38249

keys.c

diff --git a/keys.c b/keys.c
index a65adba8f1154225aa6281b79d37f843324e6a39..de6b3cefcc82a92bdce4639ddba6f0524b79ff4d 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1017,21 +1017,21 @@ Key_Event (int key, char ascii, qboolean down)
                return;
        }
 
-#if 0
-       // ignore binds (other than the above escape/F1-F12 keys) while in console
-       if (key_consoleactive && down)
-#else
-       // respond to toggleconsole binds while in console unless the pressed key
-       // happens to be the color prefix character (such as on German keyboards)
-       if (keydest == key_console && key_consoleactive && (!con_closeontoggleconsole.integer || !bind || strncmp(bind, "toggleconsole", strlen("toggleconsole")) || ascii == STRING_COLOR_TAG))
-#endif
+       // send input to console if it wants it
+       if (keydest == key_console && key != K_ESCAPE)
        {
-               if(down) {
-                       if(key == K_ESCAPE)
-                               MR_ToggleMenu_f();
-                       else
-                               Key_Console (key, ascii);
+               if (!down)
+                       return;
+               // con_closeontoggleconsole enables toggleconsole keys to close the
+               // console, as long as they are not the color prefix character
+               // (special exemption for german keyboard layouts)
+               if (con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && (key_consoleactive & KEY_CONSOLEACTIVE_USER) && ascii != STRING_COLOR_TAG)
+               {
+                       Con_ToggleConsole_f ();
+                       tbl_keydest[key] = key_void; // ignore the release
+                       return;
                }
+               Key_Console (key, ascii);
                return;
        }