]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow closing the Welcome dialog with Enter and Space
authorterencehill <piuntn@gmail.com>
Thu, 10 Mar 2022 23:25:40 +0000 (00:25 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 10 Mar 2022 23:25:40 +0000 (00:25 +0100)
qcsrc/menu/xonotic/dialog_welcome.qc
qcsrc/menu/xonotic/dialog_welcome.qh

index bf2a711632c3c9868fa720c0c7da56dcf7eec063..4c3166649d88304810918dc02e02eabe47f17723 100644 (file)
@@ -17,6 +17,19 @@ void welcomeDialog_resetStrings(entity me)
                strunzone(me.serverinfo_MOTD);
        me.serverinfo_MOTD = strzone(_("<NO MOTD>"));
 }
+float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shift)
+{
+       switch(key)
+       {
+               case K_KP_ENTER:
+               case K_ENTER:
+               case K_SPACE:
+                       XonoticWelcomeDialog_close(me);
+                       return true;
+               default:
+                       return SUPER(XonoticWelcomeDialog).keyDown(me, key, ascii, shift);
+       }
+}
 void XonoticWelcomeDialog_close(entity me)
 {
        SUPER(XonoticWelcomeDialog).close(me);
index 5b4881bcf6b83176967e1b889a94c85c35db1a3f..a1666ed029693a990f1d5e9cf82f19a0c65c8d1d 100644 (file)
@@ -10,6 +10,7 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog)
        ATTRIB(XonoticWelcomeDialog, columns, float, 4);
        ATTRIB(XonoticWelcomeDialog, name, string, "Welcome");
 
+       METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float));
        METHOD(XonoticWelcomeDialog, close, void(entity));
        METHOD(XonoticWelcomeDialog, configureDialog, void(entity));
        METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, float));