From 2212cf438cdceaca1b770c4c741a15db7bb0833d Mon Sep 17 00:00:00 2001 From: Elyviere Date: Mon, 1 Jan 2024 18:26:24 +0100 Subject: [PATCH] Remove requirement of certain keys as compose keys. Any key can now be used as the compose key. --- src/wincompose/settings/Settings.cs | 31 +-------------------------- src/wincompose/ui/KeySelector.xaml.cs | 4 ++-- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/src/wincompose/settings/Settings.cs b/src/wincompose/settings/Settings.cs index d4da9e61..68b4e91a 100644 --- a/src/wincompose/settings/Settings.cs +++ b/src/wincompose/settings/Settings.cs @@ -121,7 +121,6 @@ public static string Version [EntryLocation("advanced", "ignore_regex")] public static SettingsEntry IgnoreRegex { get; } = new SettingsEntry(""); - public static IEnumerable ValidComposeKeys => m_valid_compose_keys; public static Dictionary ValidLanguages => m_valid_languages; public static IList ValidLedKeys { get; } = new List @@ -162,9 +161,7 @@ private static void ValidateSettings() // but re-add it if there are no valid keys at all. foreach (Key k in ComposeKeys.Value) { - bool is_valid = (k.VirtualKey >= VK.F1 && k.VirtualKey <= VK.F24) - || m_valid_compose_keys.Contains(k); - if (is_valid && k.VirtualKey != VK.DISABLED && !compose_keys.Contains(k)) + if (k.VirtualKey != VK.DISABLED && !compose_keys.Contains(k)) compose_keys.Add(k); } @@ -359,32 +356,6 @@ public static bool GetGenericSequenceResult(KeySequence sequence, out string res // Tree of all known sequences private static SequenceTree m_sequences = new SequenceTree(); - // FIXME: couldn't we accept any compose key? - private static readonly KeySequence m_valid_compose_keys = new KeySequence - { - new Key(VK.DISABLED), - new Key(VK.LMENU), - new Key(VK.RMENU), - new Key(VK.LCONTROL), - new Key(VK.RCONTROL), - new Key(VK.LWIN), - new Key(VK.RWIN), - new Key(VK.CAPITAL), - new Key(VK.NUMLOCK), - new Key(VK.PAUSE), - new Key(VK.APPS), - new Key(VK.ESCAPE), - new Key(VK.CONVERT), - new Key(VK.NONCONVERT), - new Key(VK.INSERT), - new Key(VK.SNAPSHOT), - new Key(VK.SCROLL), - new Key(VK.TAB), - new Key(VK.HOME), - new Key(VK.END), - new Key("`"), - }; - private static readonly Key m_default_compose_key = new Key(VK.RMENU); private static readonly diff --git a/src/wincompose/ui/KeySelector.xaml.cs b/src/wincompose/ui/KeySelector.xaml.cs index c85a700b..f571bca2 100644 --- a/src/wincompose/ui/KeySelector.xaml.cs +++ b/src/wincompose/ui/KeySelector.xaml.cs @@ -36,8 +36,8 @@ public static string CancelButtonText private void KeyCaptured(Key k) { - // Only accept non-printing keys for now, except Escape. - if (k.VirtualKey != VK.ESCAPE && !k.IsPrintable) + // Don't accept Escape as compose key. + if (k.VirtualKey != VK.ESCAPE) { Key = k; // Close window from the right thread. Performance is not a