From d4611c823e9fa42ed6915a729418773239c899a6 Mon Sep 17 00:00:00 2001 From: Sander van Dijk Date: Fri, 5 Oct 2012 18:58:59 +0000 Subject: [PATCH] more mouse grab/release fixes git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@759 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/cl_main.c | 10 ++++++++++ Quake/gl_vidsdl.c | 21 ++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Quake/cl_main.c b/Quake/cl_main.c index 5dfd7605..d7484e1e 100644 --- a/Quake/cl_main.c +++ b/Quake/cl_main.c @@ -133,6 +133,11 @@ 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; @@ -145,6 +150,11 @@ 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 fe224a3b..59c824b5 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -411,6 +411,11 @@ 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"); + + if (vid_fullscreen.value) + IN_Activate(); + else if (key_dest == key_console || key_dest == key_menu) + IN_Deactivate(vid.type == MODE_WINDOWED); } /* @@ -1345,6 +1350,11 @@ void VID_Toggle (void) was_changed = vid_changed; Cvar_SetQuick (&vid_fullscreen, vid_fullscreen.value ? "0" : "1"); vid_changed = was_changed; + + if (vid_fullscreen.value) + IN_Activate(); + else if (key_dest == key_console || key_dest == key_menu) + IN_Deactivate(vid.type == MODE_WINDOWED); } else { @@ -1702,10 +1712,15 @@ static void VID_MenuKey (int key) Cbuf_AddText ("vid_test\n"); break; case 6: - Cbuf_AddText ("vid_restart\n"); - key_dest = key_game; m_state = m_none; - IN_Activate(); + Cbuf_AddText ("vid_restart\n"); + if (cls.state == ca_connected) + { + key_dest = key_game; + IN_Activate(); + } + else + key_dest = key_console; break; default: break;