Display Unicode character for keys in HotkeySettingsControl (#2249)

* Fix HotkeyControl virtual key display

* A new interop project was setup to provide wrappers for C# projects
  that want to access functionality in the common project.

* Add assembly info

* Remove WIN32 configurations
This commit is contained in:
Tomas Agustin Raies
2020-04-20 21:01:21 -07:00
committed by GitHub
parent d45c4740ad
commit 93752fb6cb
31 changed files with 868 additions and 350 deletions

View File

@@ -31,4 +31,8 @@
<PackageReference Include="System.Text.Json" Version="4.7.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\interop\interop.vcxproj" />
</ItemGroup>
</Project>

View File

@@ -64,5 +64,12 @@ namespace Microsoft.PowerToys.Settings.UI.Lib.Utilities
[DllImport("user32.dll")]
private static extern bool AllowSetForegroundWindow(int dwProcessId);
private static interop.LayoutMapManaged layoutMap = new interop.LayoutMapManaged();
public static string GetKeyName(uint key)
{
return layoutMap.GetKeyName(key);
}
}
}

View File

@@ -90,7 +90,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
settings.Shift = true;
}
settings.Key = e.Key.ToString();
settings.Key = Lib.Utilities.Helper.GetKeyName((uint)e.Key);
// TODO: Check that e.OriginalKey is the ScanCode. It is not clear from docs.
settings.Code = (int)e.OriginalKey;