From 31453e6cfa8e94e285c4a0540628371ebce8113f Mon Sep 17 00:00:00 2001 From: svdijk Date: Sat, 6 Oct 2012 18:09:23 +0000 Subject: [PATCH] revert (most of) r521, r756 and r759. Alter "gamekey" handling a bit to compensate. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@761 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/cl_main.c | 10 ---------- Quake/gl_vidsdl.c | 17 ++++++++--------- Quake/in_sdl.c | 6 ++++-- Quake/menu.c | 18 ++++-------------- Quake/net_dgrm.c | 1 + 5 files changed, 17 insertions(+), 35 deletions(-) diff --git a/Quake/cl_main.c b/Quake/cl_main.c index d7484e1e..5dfd7605 100644 --- a/Quake/cl_main.c +++ b/Quake/cl_main.c @@ -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); - } } diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index eaec8975..0d962b03 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -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; diff --git a/Quake/in_sdl.c b/Quake/in_sdl.c index 1111c85c..79777f33 100644 --- a/Quake/in_sdl.c +++ b/Quake/in_sdl.c @@ -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; diff --git a/Quake/menu.c b/Quake/menu.c index 9c3af2f4..df5224e9 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -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: */ diff --git a/Quake/net_dgrm.c b/Quake/net_dgrm.c index b573db8d..a2eb7055 100644 --- a/Quake/net_dgrm.c +++ b/Quake/net_dgrm.c @@ -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;