fixed #240: Workaround for hotkey Windows modifier support

This commit is contained in:
Jaex 2015-07-21 03:25:38 +03:00
parent 22c32db065
commit 8a011a5611
2 changed files with 20 additions and 18 deletions

View file

@ -128,6 +128,11 @@ private void btnHotkey_KeyDown(object sender, KeyEventArgs e)
Setting.HotkeyInfo.Hotkey = Keys.None; Setting.HotkeyInfo.Hotkey = Keys.None;
StopEditing(); StopEditing();
} }
else if (e.KeyCode == Keys.LWin || e.KeyCode == Keys.RWin)
{
Setting.HotkeyInfo.Win = !Setting.HotkeyInfo.Win;
UpdateHotkeyText();
}
else if (new HotkeyInfo(e.KeyData).IsValidHotkey) else if (new HotkeyInfo(e.KeyData).IsValidHotkey)
{ {
Setting.HotkeyInfo.Hotkey = e.KeyData; Setting.HotkeyInfo.Hotkey = e.KeyData;

View file

@ -101,7 +101,7 @@ public bool IsOnlyModifiers
{ {
get get
{ {
return KeyCode == Keys.ControlKey || KeyCode == Keys.ShiftKey || KeyCode == Keys.Menu; return KeyCode == Keys.ControlKey || KeyCode == Keys.ShiftKey || KeyCode == Keys.Menu || (KeyCode == Keys.None && Win);
} }
} }
@ -134,27 +134,24 @@ public override string ToString()
{ {
string text = string.Empty; string text = string.Empty;
if (KeyCode != Keys.None) if (Control)
{ {
if (Control) text += "Ctrl + ";
{ }
text += "Ctrl + ";
}
if (Shift) if (Shift)
{ {
text += "Shift + "; text += "Shift + ";
} }
if (Alt) if (Alt)
{ {
text += "Alt + "; text += "Alt + ";
} }
if (Win) if (Win)
{ {
text += "Win + "; text += "Win + ";
}
} }
if (IsOnlyModifiers) if (IsOnlyModifiers)