From: Severin Meyer Date: Fri, 14 Nov 2014 10:47:53 +0000 (+0100) Subject: Switch focus to the maplist when pressing ENTER in the gametypelist X-Git-Tag: xonotic-v0.8.0~148^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1eabf2d13ab007ec8a7df18645b9d78ef84b422f;p=xonotic%2Fxonotic-data.pk3dir.git Switch focus to the maplist when pressing ENTER in the gametypelist --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.c b/qcsrc/menu/xonotic/dialog_multiplayer_create.c index f3811f5b9..e4aa1d6d9 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create.c @@ -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 diff --git a/qcsrc/menu/xonotic/gametypelist.c b/qcsrc/menu/xonotic/gametypelist.c index 02f17dddb..3492903c4 100644 --- a/qcsrc/menu/xonotic/gametypelist.c +++ b/qcsrc/menu/xonotic/gametypelist.c @@ -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