Skip to content

Commit

Permalink
save toolbar position even if not allowing dragging; fix hotkey inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
geovens committed Jun 30, 2019
1 parent 5098d4b commit c805077
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/FormCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public FormCollection(Root root)

gpButtonsWidth = gpButtons.Width;
gpButtonsHeight = gpButtons.Height;
if (Root.AllowDraggingToolbar)
if (true || Root.AllowDraggingToolbar)
{
gpButtonsLeft = Root.gpButtonsLeft;
gpButtonsTop = Root.gpButtonsTop;
Expand Down
28 changes: 18 additions & 10 deletions src/HotkeyInputBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,13 @@ protected override void OnKeyDown(KeyEventArgs e)
Keys modifierKeys = e.Modifiers;
Keys pressedKey = e.KeyData ^ modifierKeys;

if (pressedKey == Keys.Escape || pressedKey == Keys.Delete)
bool deleting = pressedKey == Keys.Escape || pressedKey == Keys.Delete || pressedKey == Keys.Back;

if (deleting)
{
Text = "None";
Hotkey.Key = 0;
Hotkey.Control = false;
Hotkey.Alt = false;
Hotkey.Shift = false;
Hotkey.Win = false;
}

else if (modifierKeys != Keys.None)
else
{
Text = "";
if ((modifierKeys & Keys.Control) > 0)
Expand All @@ -122,8 +118,20 @@ protected override void OnKeyDown(KeyEventArgs e)
Text += (char)pressedKey;
}


if ((!RequireModifier || modifierKeys != Keys.None) && Hotkey.IsValidKey(pressedKey))
if (deleting)
{
Hotkey.Key = 0;
Hotkey.Control = false;
Hotkey.Alt = false;
Hotkey.Shift = false;
Hotkey.Win = false;
HotkeyJustSet = true;
_InWaitingKey = false;
SetBackColor();
if (OnHotkeyChanged != null)
OnHotkeyChanged(this, null);
}
else if ((!RequireModifier || modifierKeys != Keys.None) && Hotkey.IsValidKey(pressedKey))
{
Hotkey.Key = (int)pressedKey;
Hotkey.Control = (modifierKeys & Keys.Control) > 0;
Expand Down

0 comments on commit c805077

Please sign in to comment.