Menu: Add input redirection verification in case we've forcefully changed menu input modes.

This commit is contained in:
Marco Cawthorne 2020-09-29 14:24:21 +02:00
parent 8fab5921a0
commit 1a0193ad3a
2 changed files with 25 additions and 7 deletions

View file

@ -184,16 +184,25 @@ m_draw(vector screensize)
g_background = cvar("_background");
/* make sure input carries over when a map background is active */
if (g_background) {
setkeydest(KEY_MENU);
setmousetarget(TARGET_MENU);
setcursormode(TRUE, "gfx/cursor");
if (getkeydest() != KEY_MENU) {
setkeydest(KEY_MENU);
setmousetarget(TARGET_MENU);
setcursormode(TRUE, "gfx/cursor");
}
}
/* to prevent TCP timeouts */
menu_chatrooms_keepalive();
if (!g_active && !g_background) {
/* make sure we're redirecting input when the background's gone */
if (getkeydest() != KEY_GAME) {
setkeydest(KEY_GAME);
setmousetarget(TARGET_CLIENT);
setcursormode(FALSE);
}
return;
}

View file

@ -65,13 +65,22 @@ void m_draw ( vector vecScreensize )
g_background = cvar("_background");
/* make sure input carries over when a map background is active */
if (g_background) {
setkeydest(KEY_MENU);
setmousetarget(TARGET_MENU);
setcursormode(TRUE, "gfx/cursor");
if (getkeydest() != KEY_MENU) {
setkeydest(KEY_MENU);
setmousetarget(TARGET_MENU);
setcursormode(TRUE, "gfx/cursor");
}
}
if ( !g_iMenuActive && !g_background ) {
if (!g_iMenuActive && !g_background) {
/* make sure we're redirecting input when the background's gone */
if (getkeydest() != KEY_GAME) {
setkeydest(KEY_GAME);
setmousetarget(TARGET_CLIENT);
setcursormode(FALSE);
}
return;
}