Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow any key as compose key #516

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions src/wincompose/settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public static string Version
[EntryLocation("advanced", "ignore_regex")]
public static SettingsEntry<string> IgnoreRegex { get; } = new SettingsEntry<string>("");

public static IEnumerable<Key> ValidComposeKeys => m_valid_compose_keys;
public static Dictionary<string, string> ValidLanguages => m_valid_languages;

public static IList<Key> ValidLedKeys { get; } = new List<Key>
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/wincompose/ui/KeySelector.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down