implemented in_noGrab on Windows

This commit is contained in:
myT 2017-10-29 02:36:57 +02:00
parent 27afb67ed1
commit 6238d7dd7f
3 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,8 @@
DD Mmm 17 - 1.49
add: in_noGrab <0|1> (default: 0) disables input grabbing
add: bindkeylist command to print all bindable key names
add: uptime command that prints uptimes for the process, the current map and the parent process
@ -146,8 +148,6 @@ Linux:
chg: the client requires SDL 2 - the following things are handled by it:
window, GL context, video modes, audio, kb and mouse input, monitor list, clipboard
add: in_noGrab <0|1> (default: 0) disables input grabbing
add: m_relative <0|1> (default: 1) enables SDL's relative mouse mode
you might want to set it to 0 if you have a messed up input driver

View file

@ -13,7 +13,7 @@ static cvar_t* m_relative;
static cvar_t* s_autoMute;
static const cvarTableItem_t in_cvars[] = {
{ &in_noGrab, "in_noGrab", "0", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, "disables input grabbing" },
{ &in_noGrab, "in_noGrab", "0", 0, CVART_BOOL, NULL, NULL, "disables input grabbing" },
{ &m_relative, "m_relative", "1", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, "enables SDL's relative mouse mode" },
{ &s_autoMute, "s_autoMute", "1", CVAR_ARCHIVE, CVART_INTEGER, "0", "2", "0=never, 1=when unfocused, 2=when minimized" }
};

View file

@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "win_help.h"
static cvar_t* in_noGrab;
struct Mouse {
Mouse() : active(qfalse), wheel(0) {}
@ -279,6 +282,10 @@ static void IN_StartupMouse()
Cvar_SetHelp( "in_mouse", help_in_mouse );
in_mouse->modified = qfalse;
in_noGrab = Cvar_Get( "in_noGrab", "0", 0 );
Cvar_SetRange( "in_noGrab", CVART_BOOL, NULL, NULL );
Cvar_SetHelp( "in_noGrab", "disables input grabbing" );
if (!in_mouse->integer) {
Com_Printf( "Mouse not active.\n" );
return;
@ -413,6 +420,9 @@ void IN_Activate( qbool active )
static qbool IN_ShouldBeActive()
{
if ( in_noGrab && in_noGrab->integer )
return qfalse;
return g_wv.activeApp && (!(cls.keyCatchers & KEYCATCH_CONSOLE) || Cvar_VariableIntegerValue("r_fullscreen"));
}