about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-10-21 16:50:10 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-10-21 16:50:10 +0000
commitb0836b7909633a6afc93267cc78c765823ada4ae (patch)
treef29b2ba72d310f2376f177a8fb2db6cb16227ec9
parent8c1ed7d81d9ec98ac31c717e19e9f490c5c92b14 (diff)
downloadzcatch-b0836b7909633a6afc93267cc78c765823ada4ae.tar.gz
zcatch-b0836b7909633a6afc93267cc78c765823ada4ae.zip
tried to improve mouse focusing
-rw-r--r--src/engine/client/ec_gfx.c4
-rw-r--r--src/engine/client/ec_inp.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c
index 09d8d57b..1f9ec642 100644
--- a/src/engine/client/ec_gfx.c
+++ b/src/engine/client/ec_gfx.c
@@ -538,7 +538,7 @@ int gfx_window_active()
 #ifdef CONFIG_NO_SDL
 	return glfwGetWindowParam(GLFW_ACTIVE) == GL_TRUE ? 1 : 0;
 #else
-	return 1; /* TODO: SDL*/
+	return SDL_GetAppState()&SDL_APPINPUTFOCUS; /* TODO: SDL*/
 #endif
 }
 
@@ -547,7 +547,7 @@ int gfx_window_open()
 #ifdef CONFIG_NO_SDL
 	return glfwGetWindowParam(GLFW_OPENED) == GL_TRUE ? 1 : 0;
 #else
-	return 1; /* TODO: SDL*/
+	return SDL_GetAppState()&SDL_APPACTIVE; /* TODO: SDL*/
 #endif
 }
 
diff --git a/src/engine/client/ec_inp.c b/src/engine/client/ec_inp.c
index d639cf72..dc21bdae 100644
--- a/src/engine/client/ec_inp.c
+++ b/src/engine/client/ec_inp.c
@@ -35,7 +35,7 @@ static int input_current = 0;
 static unsigned int last_release = 0;
 #else
 static int input_grabbed = 0;
-static int input_use_grab = 1;
+static int input_use_grab = 0;
 #endif
 static unsigned int release_delta = -1;
 
@@ -296,6 +296,12 @@ void inp_update()
 #else
 	int i;
 	
+	if(input_grabbed && !gfx_window_active())
+		inp_mouse_mode_absolute();
+
+	/*if(!input_grabbed && gfx_window_active())
+		inp_mouse_mode_relative();*/
+	
 	/* clear and begin count on the other one */
 	mem_zero(&input_count[input_current], sizeof(input_count[input_current]));
 	mem_copy(input_state[input_current], input_state[input_current^1], sizeof(input_state[input_current]));