Changed dummy key event to send key down and key up to improve compatibility with applications (#7166)

This commit is contained in:
Arjun Balgovind
2020-10-08 11:28:37 -07:00
committed by GitHub
parent e1d22c74b0
commit 42ebc42c98
4 changed files with 33 additions and 25 deletions

View File

@@ -6,6 +6,7 @@
#include "../../common/common.h"
#include "keyboardmanager/dll/Generated Files/resource.h"
#include "../common/keyboard_layout.h"
#include "KeyboardManagerConstants.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt::Windows::Foundation;
@@ -193,6 +194,15 @@ namespace KeyboardManagerHelper
keyEventArray[index].ki.dwExtraInfo = extraInfo;
}
// Function to set the dummy key events used for remapping shortcuts, required to ensure releasing a modifier doesn't trigger another action (For example, Win->Start Menu or Alt->Menu bar)
void SetDummyKeyEvent(LPINPUT keyEventArray, int& index, ULONG_PTR extraInfo)
{
SetKeyEvent(keyEventArray, index, INPUT_KEYBOARD, (WORD)KeyboardManagerConstants::DUMMY_KEY, 0, extraInfo);
index++;
SetKeyEvent(keyEventArray, index, INPUT_KEYBOARD, (WORD)KeyboardManagerConstants::DUMMY_KEY, KEYEVENTF_KEYUP, extraInfo);
index++;
}
// Function to return window handle for a full screen UWP app
HWND GetFullscreenUWPWindowHandle()
{