mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 03:12:38 +00:00
Prevent input.setMouseGrab from interfering with window focus
This commit is contained in:
parent
5340db5f67
commit
9b7263855e
4 changed files with 15 additions and 3 deletions
|
@ -43,6 +43,7 @@
|
|||
#include "lzf.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
#include "lua_libs.h"
|
||||
#include "md5.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
|
@ -3331,6 +3332,9 @@ static inline void SV_GenContext(void)
|
|||
//
|
||||
void D_QuitNetGame(void)
|
||||
{
|
||||
mousegrabbedbylua = true;
|
||||
I_UpdateMouseGrab();
|
||||
|
||||
if (!netgame || !netbuffer)
|
||||
return;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
boolean mousegrabbedbylua = true;
|
||||
|
||||
///////////////
|
||||
// FUNCTIONS //
|
||||
///////////////
|
||||
|
@ -106,14 +108,14 @@ static int lib_shiftKeyNum(lua_State *L)
|
|||
|
||||
static int lib_getMouseGrab(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, I_GetMouseGrab());
|
||||
lua_pushboolean(L, mousegrabbedbylua);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_setMouseGrab(lua_State *L)
|
||||
{
|
||||
boolean grab = luaL_checkboolean(L, 1);
|
||||
I_SetMouseGrab(grab);
|
||||
mousegrabbedbylua = luaL_checkboolean(L, 1);
|
||||
I_UpdateMouseGrab();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
extern lua_State *gL;
|
||||
|
||||
extern boolean mousegrabbedbylua;
|
||||
|
||||
#define MUTABLE_TAGS
|
||||
|
||||
#define LREG_VALID "VALID_USERDATA"
|
||||
|
|
|
@ -73,6 +73,8 @@
|
|||
#include "../console.h"
|
||||
#include "../command.h"
|
||||
#include "../r_main.h"
|
||||
#include "../lua_script.h"
|
||||
#include "../lua_libs.h"
|
||||
#include "../lua_hook.h"
|
||||
#include "sdlmain.h"
|
||||
#ifdef HWRENDER
|
||||
|
@ -372,6 +374,8 @@ static boolean IgnoreMouse(void)
|
|||
if (gamestate != GS_LEVEL && gamestate != GS_INTERMISSION &&
|
||||
gamestate != GS_CONTINUING && gamestate != GS_CUTSCENE)
|
||||
return true;
|
||||
if (!mousegrabbedbylua)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue