Disable keyboard input when main window out of focus - entry into dialogs no longer picked up by emulator.
Set RIDEV_NOHOTKEYS when registering raw input devices - Windows key and some other shortcuts no longer affect emulator.
This commit is contained in:
parent
1c9b6e45f3
commit
18512b310f
1 changed files with 5 additions and 1 deletions
|
|
@ -444,7 +444,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
memset(rawinputkey, 0, sizeof(rawinputkey));
|
memset(rawinputkey, 0, sizeof(rawinputkey));
|
||||||
device.usUsagePage = 0x01;
|
device.usUsagePage = 0x01;
|
||||||
device.usUsage = 0x06;
|
device.usUsage = 0x06;
|
||||||
device.dwFlags = 0;
|
device.dwFlags = RIDEV_NOHOTKEYS;
|
||||||
device.hwndTarget = hwnd;
|
device.hwndTarget = hwnd;
|
||||||
|
|
||||||
if (RegisterRawInputDevices(&device, 1, sizeof(device)))
|
if (RegisterRawInputDevices(&device, 1, sizeof(device)))
|
||||||
|
|
@ -909,6 +909,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
UINT size;
|
UINT size;
|
||||||
RAWINPUT *raw;
|
RAWINPUT *raw;
|
||||||
|
|
||||||
|
if (!infocus)
|
||||||
|
break;
|
||||||
|
|
||||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
||||||
|
|
||||||
raw = malloc(size);
|
raw = malloc(size);
|
||||||
|
|
@ -968,6 +971,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
mousecapture=0;
|
mousecapture=0;
|
||||||
}
|
}
|
||||||
// pclog("Lost focus!\n");
|
// pclog("Lost focus!\n");
|
||||||
|
memset(rawinputkey, 0, sizeof(rawinputkey));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue