Add in missing telemetry for Keyboard Manager usage (#6393)

* Added key remap invoked telemetry event

* Added queryperformance call

* Added in telemetry for key and shortcut remaps

* Removed redundant if check
This commit is contained in:
Arjun Balgovind
2020-09-08 14:40:02 -07:00
committed by GitHub
parent 1a51f77fce
commit fdd7d6afa4
3 changed files with 79 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
#include <keyboardmanager/common/KeyboardManagerState.h>
#include <keyboardmanager/common/InputInterface.h>
#include <keyboardmanager/common/Helpers.h>
#include <keyboardmanager/common/trace.h>
namespace KeyboardEventHandlers
{
@@ -98,9 +99,12 @@ namespace KeyboardEventHandlers
UINT res = ii.SendVirtualInput(key_count, keyEventList, sizeof(INPUT));
delete[] keyEventList;
// If Caps Lock is being remapped to Ctrl/Alt/Shift, then reset the modifier key state to fix issues in certain IME keyboards where the IME shortcut gets invoked since it detects that the modifier and Caps Lock is pressed even though it is suppressed by the hook - More information at the GitHub issue https://github.com/microsoft/PowerToys/issues/3397
if (data->wParam == WM_KEYDOWN || data->wParam == WM_SYSKEYDOWN)
{
// Log telemetry event when the key remap is invoked
Trace::KeyRemapInvoked(remapToKey);
// If Caps Lock is being remapped to Ctrl/Alt/Shift, then reset the modifier key state to fix issues in certain IME keyboards where the IME shortcut gets invoked since it detects that the modifier and Caps Lock is pressed even though it is suppressed by the hook - More information at the GitHub issue https://github.com/microsoft/PowerToys/issues/3397
if (remapToKey)
{
ResetIfModifierKeyForLowerLevelKeyHandlers(ii, target, it->first);
@@ -311,6 +315,10 @@ namespace KeyboardEventHandlers
lock.unlock();
UINT res = ii.SendVirtualInput((UINT)key_count, keyEventList, sizeof(INPUT));
delete[] keyEventList;
// Log telemetry event when shortcut remap is invoked
Trace::ShortcutRemapInvoked(remapToShortcut, activatedApp != KeyboardManagerConstants::NoActivatedApp);
return 1;
}
}