]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Switch focus to the maplist when pressing ENTER in the gametypelist
authorSeverin Meyer <sev.ch@web.de>
Fri, 14 Nov 2014 10:47:53 +0000 (11:47 +0100)
committerSeverin Meyer <sev.ch@web.de>
Fri, 14 Nov 2014 10:47:53 +0000 (11:47 +0100)
qcsrc/menu/xonotic/dialog_multiplayer_create.c
qcsrc/menu/xonotic/gametypelist.c

index f3811f5b94c3e52e83cd0b7b352bc1c5690142e8..e4aa1d6d97d30600e76a779ee1d26ce228f920d5 100644 (file)
@@ -2,6 +2,7 @@
 CLASS(XonoticServerCreateTab) EXTENDS(XonoticTab)
        METHOD(XonoticServerCreateTab, fill, void(entity))
        METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity))
+       METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity))
        ATTRIB(XonoticServerCreateTab, title, string, _("Create"))
        ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
        ATTRIB(XonoticServerCreateTab, rows, float, 22)
@@ -165,4 +166,9 @@ void XonoticServerCreateTab_gameTypeChangeNotify(entity me)
        me.mapListBox.refilter(me.mapListBox);
 }
 
+void XonoticServerCreateTab_gameTypeSelectNotify(entity me)
+{
+       me.setFocus(me, me.mapListBox);
+}
+
 #endif
index 02f17dddb70b2fd459c8556d4e478b4a1cd2b0e9..3492903c4039d9a50416bef3b8f8e60edb0ae722 100644 (file)
@@ -7,6 +7,7 @@ CLASS(XonoticGametypeList) EXTENDS(XonoticListBox)
        METHOD(XonoticGametypeList, setSelected, void(entity, float))
        METHOD(XonoticGametypeList, loadCvars, void(entity))
        METHOD(XonoticGametypeList, saveCvars, void(entity))
+       METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float))
 
        ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
        ATTRIB(XonoticGametypeList, realUpperMargin1, float, 0)
@@ -101,4 +102,15 @@ void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSiz
        me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize;
        me.columnNameSize = 1 - me.columnIconSize - 2 * me.realFontSize_x;
 }
+
+float XonoticGametypeList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               me.parent.gameTypeSelectNotify(me.parent);
+               return 1;
+       }
+
+       return SUPER(XonoticDemoList).keyDown(me, scan, ascii, shift);
+}
 #endif