MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Menu_HandleKey

Function Menu_HandleKey

code/ui/ui_shared.cpp:11158–11443  ·  view source on GitHub ↗

================= Menu_HandleKey ================= */

Source from the content-addressed store, hash-verified

11156=================
11157*/
11158void Menu_HandleKey(menuDef_t *menu, int key, qboolean down)
11159{
11160 int i;
11161 itemDef_t *item = NULL;
11162 qboolean inHandler = qfalse;
11163
11164 if (inHandler)
11165 {
11166 return;
11167 }
11168
11169 inHandler = qtrue;
11170 if (g_waitingForKey && down)
11171 {
11172 Item_Bind_HandleKey(g_bindItem, key, down);
11173 inHandler = qfalse;
11174 return;
11175 }
11176
11177 if (g_editingField && down)
11178 {
11179 if (!Item_TextField_HandleKey(g_editItem, key))
11180 {
11181 g_editingField = qfalse;
11182 g_editItem = NULL;
11183 inHandler = qfalse;
11184 return;
11185 }
11186 else if (key == A_MOUSE1 || key == A_MOUSE2 || key == A_MOUSE3)
11187 {
11188 g_editingField = qfalse;
11189 g_editItem = NULL;
11190 Display_MouseMove(NULL, DC->cursorx, DC->cursory);
11191 }
11192 else if (key == A_TAB || key == A_CURSOR_UP || key == A_CURSOR_DOWN)
11193 {
11194 return;
11195 }
11196 }
11197
11198 if (menu == NULL)
11199 {
11200 inHandler = qfalse;
11201 return;
11202 }
11203
11204 //JLFMOUSE MPMOVED
11205 // see if the mouse is within the window bounds and if so is this a mouse click
11206 if (down && !(menu->window.flags & WINDOW_POPUP) && !Rect_ContainsPoint(&menu->window.rect, DC->cursorx, DC->cursory))
11207 {
11208 static qboolean inHandleKey = qfalse;
11209 if (!inHandleKey && (key == A_MOUSE1 || key == A_MOUSE2 || key == A_MOUSE3))
11210 {
11211 inHandleKey = qtrue;
11212 Menus_HandleOOBClick(menu, key, down);
11213 inHandleKey = qfalse;
11214 inHandler = qfalse;
11215 return;

Callers 2

_UI_KeyEventFunction · 0.70
Menus_HandleOOBClickFunction · 0.70

Calls 13

Q_stricmpFunction · 0.85
Item_Bind_HandleKeyFunction · 0.70
Item_TextField_HandleKeyFunction · 0.70
Display_MouseMoveFunction · 0.70
Rect_ContainsPointFunction · 0.70
Menus_HandleOOBClickFunction · 0.70
Item_HandleKeyFunction · 0.70
Item_ActionFunction · 0.70
Menu_SetPrevCursorItemFunction · 0.70
Item_RunScriptFunction · 0.70
Menu_SetNextCursorItemFunction · 0.70
Item_HandleAcceptFunction · 0.70

Tested by

no test coverage detected