ref: 65d71cecde9091b4c926dd5711d3bf46fcba37fd
parent: 0d66c828824abe9951af3fcfba6edc42279572bf
author: Konstantinn Bonnet <[email protected]>
date: Sun Mar 15 09:36:28 EDT 2015
ungrab mouse when opening menu or ingame console
--- a/client/console.c
+++ b/client/console.c
@@ -89,6 +89,7 @@
{
M_ForceMenuOff ();
Cvar_Set ("paused", "0");
+ IN_Grabm (1);
}
else
{
@@ -98,6 +99,7 @@
if (Cvar_VariableValue ("maxclients") == 1
&& Com_ServerState ())
Cvar_Set ("paused", "1");
+ IN_Grabm (0);
}
}
--- a/client/input.h
+++ b/client/input.h
@@ -32,3 +32,5 @@
// add additional movement on top of the keyboard move cmd
void IN_Activate (qboolean active);
+
+void IN_Grabm(int on);
--- a/client/menu.c
+++ b/client/menu.c
@@ -122,6 +122,7 @@
m_menudepth = 0;
Key_ClearStates ();
Cvar_Set ("paused", "0");
+ IN_Grabm (1);
}
void M_PopMenu (void)
@@ -487,6 +488,7 @@
void M_Menu_Main_f (void)
{
+ IN_Grabm (0);
M_PushMenu (M_Main_Draw, M_Main_Key);
}
--- a/plan9/in_9.c
+++ b/plan9/in_9.c
@@ -48,7 +48,7 @@
if(mouseon == on)
return;
- if(mouseon = on){
+ if(mouseon = on && m_windowed->value){
if((fd = open("/dev/cursor", ORDWR|OCEXEC)) < 0){
sysfatal("IN_Grabm:open: %r\n");
return;
@@ -82,10 +82,7 @@
if(oldmwin != m_windowed->value){
oldmwin = m_windowed->value;
- if(!m_windowed->value)
- IN_Grabm(0);
- else
- IN_Grabm(1);
+ IN_Grabm(m_windowed->value);
}
while((r = nbrecv(kchan, &ev)) > 0)
Key_Event(ev.key, ev.down, Sys_Milliseconds());
@@ -276,7 +273,7 @@
mbtn = b&1 | (b&2)<<1 | (b&4)>>1;
dx += x;
dy += y;
- if(m_windowed->value && (x != 0 || y != 0))
+ if(x != 0 || y != 0)
fprint(fd, "m%d %d", center.x, center.y);
break;
}
@@ -332,8 +329,6 @@
kchan = chancreate(sizeof(Kev), Nbuf);
if((ktid = proccreate(kproc, nil, 8192)) < 0)
sysfatal("proccreate kproc: %r");
- if(m_windowed->value)
- IN_Grabm(1);
if((mtid = proccreate(mproc, nil, 8192)) < 0)
sysfatal("proccreate mproc: %r");
mx = my = 0;