ignore lmouse and rmouse lua input when main window isnt focused. it seems unlikely anyone would want these for any other purpose (xmouse and ymouse are based on the emulated window so the clicks should be too)

untested.

intended for SF bug 836
This commit is contained in:
zeromus 2018-12-17 15:11:30 -05:00
parent 14ad02632a
commit 5a1e6c552a
1 changed files with 11 additions and 0 deletions

View File

@ -2421,6 +2421,11 @@ static int input_get(lua_State *L) {
int mask = (i == VK_CAPITAL || i == VK_NUMLOCK || i == VK_SCROLL) ? 0x01 : 0x80;
if(keys[i] & mask)
{
//ignore mouse buttons if the main window isn't focused
if(i==1 || i==2)
if(GetForegroundWindow()!=hAppWnd)
continue;
const char* name = s_keyToName[i];
if(name)
{
@ -2439,6 +2444,12 @@ static int input_get(lua_State *L) {
if(name)
{
int active;
//ignore mouse buttons if the main window isn't focused
if(i==1 || i==2)
if(GetForegroundWindow()!=hAppWnd)
continue;
if(i == VK_CAPITAL || i == VK_NUMLOCK || i == VK_SCROLL)
active = GetKeyState(i) & 0x01;
else