revert (most of) r521, r756 and r759. Alter "gamekey" handling a bit to compensate.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@761 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Sander van Dijk 2012-10-06 18:09:23 +00:00
parent a19ea6b14b
commit 95d20d835f
5 changed files with 17 additions and 35 deletions

View file

@ -133,11 +133,6 @@ void CL_Disconnect (void)
cls.state = ca_disconnected;
if (sv.active)
Host_ShutdownServer(false);
if (cls.state != ca_dedicated && key_dest != key_menu)
{
key_dest = key_console;
IN_Deactivate(vid.type == MODE_WINDOWED);
}
}
cls.demoplayback = cls.timedemo = false;
@ -150,11 +145,6 @@ void CL_Disconnect_f (void)
CL_Disconnect ();
if (sv.active)
Host_ShutdownServer (false);
if (cls.state != ca_dedicated && key_dest != key_menu)
{
key_dest = key_console;
IN_Deactivate(vid.type == MODE_WINDOWED);
}
}

View file

@ -411,7 +411,9 @@ static void VID_Restart (void)
Cvar_SetValueQuick (&vid_height, modelist[vid_default].height);
Cvar_SetValueQuick (&vid_bpp, modelist[vid_default].bpp);
Cvar_SetQuick (&vid_fullscreen, (windowed) ? "0" : "1");
//
// update mouse grab
//
if (vid_fullscreen.value)
IN_Activate();
else if (key_dest == key_console || key_dest == key_menu)
@ -1351,6 +1353,7 @@ void VID_Toggle (void)
Cvar_SetQuick (&vid_fullscreen, vid_fullscreen.value ? "0" : "1");
vid_changed = was_changed;
// update mouse grab
if (vid_fullscreen.value)
IN_Activate();
else if (key_dest == key_console || key_dest == key_menu)
@ -1712,15 +1715,10 @@ static void VID_MenuKey (int key)
Cbuf_AddText ("vid_test\n");
break;
case 6:
m_state = m_none;
Cbuf_AddText ("vid_restart\n");
if (cls.state == ca_connected)
{
key_dest = key_game;
IN_Activate();
}
else
key_dest = key_console;
key_dest = key_game;
m_state = m_none;
IN_Activate();
break;
default:
break;
@ -1802,6 +1800,7 @@ VID_Menu_f
*/
static void VID_Menu_f (void)
{
IN_Deactivate(vid.type == MODE_WINDOWED);
key_dest = key_menu;
m_state = m_video;
m_entersound = true;

View file

@ -210,7 +210,8 @@ void IN_Deactivate (qboolean free_cursor)
void IN_Init (void)
{
prev_gamekey = (key_dest == key_game || m_keys_bind_grab);
prev_gamekey = ((key_dest == key_game && !con_forcedup) ||
(key_dest == key_menu && m_state == m_keys && m_keys_bind_grab));
SDL_EnableUNICODE (!prev_gamekey);
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
@ -306,7 +307,8 @@ void IN_SendKeyEvents (void)
int sym, usym, state, modstate;
qboolean gamekey;
gamekey = (key_dest == key_game || m_keys_bind_grab);
gamekey = ((key_dest == key_game && !con_forcedup) ||
(key_dest == key_menu && m_state == m_keys && m_keys_bind_grab));
if (gamekey != prev_gamekey)
{
prev_gamekey = gamekey;

View file

@ -217,13 +217,8 @@ void M_ToggleMenu_f (void)
return;
}
if (cls.state == ca_connected)
{
IN_Activate();
key_dest = key_game;
}
else
key_dest = key_console;
IN_Activate();
key_dest = key_game;
m_state = m_none;
return;
}
@ -280,13 +275,8 @@ void M_Main_Key (int key)
switch (key)
{
case K_ESCAPE:
if (cls.state == ca_connected)
{
IN_Activate();
key_dest = key_game;
}
else
key_dest = key_console;
IN_Activate();
key_dest = key_game;
m_state = m_none;
cls.demonum = m_save_demonum;
if (!fitzmode) /* QuakeSpasm customization: */

View file

@ -1399,6 +1399,7 @@ ErrorReturn2:
dfunc.Close_Socket(newsock);
if (m_return_onerror)
{
IN_Deactivate(vid.type == MODE_WINDOWED);
key_dest = key_menu;
m_state = m_return_state;
m_return_onerror = false;