shithub: qk1

Download patch

ref: ded5393bc7cf05e361bddc4cb5e3d4a8fb08edcd
parent: b475117206ea0be0d7317727baf5048b7a1ba76c
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Dec 13 18:20:13 EST 2023

add "m_raw" cvar (use mouse raw input when possible, if enabled)

--- a/unix/in.c
+++ b/unix/in.c
@@ -6,7 +6,8 @@
 
 static cvar_t m_windowed = {"m_windowed", "1", true};
 static cvar_t m_filter = {"m_filter", "0", true};
-static int mouseon, oldmwin, focuslost;
+static cvar_t m_raw = {"m_raw", "1", true};
+static int mouseon, oldmwin, focuslost, oldraw = -1;
 static float dx, dy, olddx, olddy;
 
 static int mbuttons[] = {
@@ -118,6 +119,11 @@
 	if(!mouseon)
 		return;
 
+	if(oldraw != (int)m_raw.value){
+		oldraw = m_raw.value;
+		SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, oldraw ? "0" : "1");
+	}
+
 	if(m_filter.value){
 		dx = (dx + olddx) * 0.5;
 		dy = (dy + olddy) * 0.5;
@@ -165,4 +171,5 @@
 {
 	Cvar_RegisterVariable(&m_windowed);
 	Cvar_RegisterVariable(&m_filter);
+	Cvar_RegisterVariable(&m_raw);
 }