shithub: qk1

Download patch

ref: f97a929a9e3a8f454d99b20e095c6e22306467e9
parent: 89551236f63043869f9f6aa6d030cb72f7a6cc00
author: qwx <>
date: Wed Dec 12 18:55:54 EST 2018

qw: mouse grabbing fixes

--- a/qw/cl_pred.c
+++ b/qw/cl_pred.c
@@ -130,6 +130,7 @@
 
 		cls.state = ca_active;
 		sprintf (text, "QuakeWorld: %s", cls.servername);
+		IN_Grabm(key_dest == key_game);
 	}
 
 	if (cl_nopred.value)
--- a/qw/console.c
+++ b/qw/console.c
@@ -49,11 +49,15 @@
 
 	if (key_dest == key_console)
 	{
-		if (cls.state == ca_active)
+		if (cls.state == ca_active){
 			key_dest = key_game;
+			IN_Grabm(1);
+		}
 	}
-	else
+	else{
 		key_dest = key_console;
+		IN_Grabm(0);
+	}
 	
 	Con_ClearNotify ();
 }
--- a/qw/in.c
+++ b/qw/in.c
@@ -40,7 +40,7 @@
 
 	if(oldmwin != (int)m_windowed.value){
 		oldmwin = (int)m_windowed.value;
-		IN_Grabm(oldmwin);
+		IN_Grabm(oldmwin && cls.state == ca_active);
 	}
 
 	while(r = nbrecv(inchan, &ev), r > 0)
--- a/qw/menu.c
+++ b/qw/menu.c
@@ -226,7 +226,6 @@
 {
 	m_entersound = true;
 
-	IN_Grabm(0);
 	if (key_dest == key_menu)
 	{
 		if (m_state != m_main)
@@ -244,6 +243,7 @@
 	}
 	else
 	{
+		IN_Grabm(0);
 		M_Menu_Main_f ();
 	}
 }
@@ -295,7 +295,7 @@
 		cls.demonum = m_save_demonum;
 		if (cls.demonum != -1 && !cls.demoplayback && cls.state == ca_disconnected)
 			CL_NextDemo ();
-		IN_Grabm(1);
+		IN_Grabm(cls.state == ca_active || cls.demoplayback);
 		break;
 		
 	case K_DOWNARROW: