From e5b2b7a5c3ce123bdfd517cd9ff6b61a604a8960 Mon Sep 17 00:00:00 2001 From: Robin Date: Wed, 18 Jan 2017 10:50:11 +0100 Subject: [PATCH 1/2] BUG-2051: Made changes to allow Scroll-Lock and Pause to be used as a hotkey. [skip ci] --- GreenshotPlugin/Controls/HotkeyControl.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/GreenshotPlugin/Controls/HotkeyControl.cs b/GreenshotPlugin/Controls/HotkeyControl.cs index af12f6d93..590f6090a 100644 --- a/GreenshotPlugin/Controls/HotkeyControl.cs +++ b/GreenshotPlugin/Controls/HotkeyControl.cs @@ -20,7 +20,6 @@ */ using System; -using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; @@ -48,15 +47,6 @@ namespace GreenshotPlugin.Controls { private static int _hotKeyCounter = 1; private const uint WM_HOTKEY = 0x312; private static IntPtr _hotkeyHwnd; - -// static HotkeyControl() { -// StringBuilder keyName = new StringBuilder(); -// for(uint sc = 0; sc < 500; sc++) { -// if (GetKeyNameText(sc << 16, keyName, 100) != 0) { -// LOG.DebugFormat("SC {0} = {1}", sc, keyName); -// } -// } -// } [SuppressMessage("ReSharper", "InconsistentNaming")] public enum Modifiers : uint { @@ -96,8 +86,8 @@ namespace GreenshotPlugin.Controls { // ArrayLists used to enforce the use of proper modifiers. // Shift+A isn't a valid hotkey, for instance, as it would screw up when the user is typing. - private readonly ArrayList _needNonShiftModifier; - private readonly ArrayList _needNonAltGrModifier; + private readonly IList _needNonShiftModifier = new List(); + private readonly IList _needNonAltGrModifier = new List(); private readonly ContextMenu _dummy = new ContextMenu(); @@ -138,9 +128,6 @@ namespace GreenshotPlugin.Controls { KeyUp += HotkeyControl_KeyUp; KeyDown += HotkeyControl_KeyDown; - // Fill the ArrayLists that contain all invalid hotkey combinations - _needNonShiftModifier = new ArrayList(); - _needNonAltGrModifier = new ArrayList(); PopulateModifierLists(); } @@ -180,8 +167,6 @@ namespace GreenshotPlugin.Controls { _needNonShiftModifier.Add((int)Keys.Return); _needNonShiftModifier.Add((int)Keys.Escape); _needNonShiftModifier.Add((int)Keys.NumLock); - _needNonShiftModifier.Add((int)Keys.Scroll); - _needNonShiftModifier.Add((int)Keys.Pause); // Ctrl+Alt + 0 - 9 for (Keys k = Keys.D0; k <= Keys.D9; k++) { From 9d849d1b589a161ef9e8bd4f9b9f76918bd16bf5 Mon Sep 17 00:00:00 2001 From: Robin Date: Wed, 18 Jan 2017 12:00:24 +0100 Subject: [PATCH 2/2] BUG-2116: for loop over collection which is modified caused a problem. --- Greenshot/Drawing/Fields/FieldAggregator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Greenshot/Drawing/Fields/FieldAggregator.cs b/Greenshot/Drawing/Fields/FieldAggregator.cs index cbf5377d7..3eb2f8bac 100644 --- a/Greenshot/Drawing/Fields/FieldAggregator.cs +++ b/Greenshot/Drawing/Fields/FieldAggregator.cs @@ -27,6 +27,7 @@ using Greenshot.Plugin.Drawing; using GreenshotPlugin.Interfaces.Drawing; using System.Collections.Generic; using System.ComponentModel; +using System.Linq; namespace Greenshot.Drawing.Fields { @@ -203,7 +204,7 @@ namespace Greenshot.Drawing.Fields { return; } - foreach (var drawableContainer1 in _boundContainers) + foreach (var drawableContainer1 in _boundContainers.ToList()) { var drawableContainer = (DrawableContainer) drawableContainer1; if (!drawableContainer.HasField(field.FieldType))