Merge pull request #1566 from CrazyMax/master

disable background input for Windows
This commit is contained in:
Henrik Rydgård 2013-04-28 03:22:56 -07:00
commit b66ac96ecd

View file

@ -1,4 +1,5 @@
#include "input/input_state.h" #include "input/input_state.h"
#include "Windows/WndMainWindow.h"
#include "KeyboardDevice.h" #include "KeyboardDevice.h"
#include "../Common/CommonTypes.h" #include "../Common/CommonTypes.h"
#include "../Core/HLE/sceCtrl.h" #include "../Core/HLE/sceCtrl.h"
@ -28,6 +29,7 @@ unsigned short analog_ctrl_map[] = {
}; };
int KeyboardDevice::UpdateState(InputState &input_state) { int KeyboardDevice::UpdateState(InputState &input_state) {
if (MainWindow::GetHWND() != GetForegroundWindow()) return -1;
bool alternate = GetAsyncKeyState(VK_SHIFT) != 0; bool alternate = GetAsyncKeyState(VK_SHIFT) != 0;
static u32 alternator = 0; static u32 alternator = 0;
bool doAlternate = alternate && (alternator++ % 10) < 5; bool doAlternate = alternate && (alternator++ % 10) < 5;