From 8a011a56112c12a8cf32a0eea2221cce079901d1 Mon Sep 17 00:00:00 2001 From: Jaex Date: Tue, 21 Jul 2015 03:25:38 +0300 Subject: [PATCH] fixed #240: Workaround for hotkey Windows modifier support --- ShareX/Controls/HotkeySelectionControl.cs | 5 ++++ ShareX/HotkeyInfo.cs | 33 +++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/ShareX/Controls/HotkeySelectionControl.cs b/ShareX/Controls/HotkeySelectionControl.cs index 9903b68f6..67531a806 100644 --- a/ShareX/Controls/HotkeySelectionControl.cs +++ b/ShareX/Controls/HotkeySelectionControl.cs @@ -128,6 +128,11 @@ private void btnHotkey_KeyDown(object sender, KeyEventArgs e) Setting.HotkeyInfo.Hotkey = Keys.None; 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) { Setting.HotkeyInfo.Hotkey = e.KeyData; diff --git a/ShareX/HotkeyInfo.cs b/ShareX/HotkeyInfo.cs index cb76c52af..b08bb843f 100644 --- a/ShareX/HotkeyInfo.cs +++ b/ShareX/HotkeyInfo.cs @@ -101,7 +101,7 @@ public bool IsOnlyModifiers { 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; - if (KeyCode != Keys.None) + if (Control) { - if (Control) - { - text += "Ctrl + "; - } + text += "Ctrl + "; + } - if (Shift) - { - text += "Shift + "; - } + if (Shift) + { + text += "Shift + "; + } - if (Alt) - { - text += "Alt + "; - } + if (Alt) + { + text += "Alt + "; + } - if (Win) - { - text += "Win + "; - } + if (Win) + { + text += "Win + "; } if (IsOnlyModifiers)