Skip to content

Commit

Permalink
Fix : GlobalHotkey not engaging Pointer
Browse files Browse the repository at this point in the history
Regression induced by code refactoring
cf issue #59
also prevent hotkey to be disabled when opening options (now only when entering/leaving global_hotkey)
  • Loading branch information
pubpub-zz committed Mar 8, 2021
1 parent 473e2fb commit 1539fb7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/FormCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2977,11 +2977,13 @@ private void tiSlide_Tick(object sender, EventArgs e)
}
}

if (((Root.PointerMode||!Root.FormDisplay.HasFocus()) && !Root.AllowHotkeyInPointerMode) || Root.Snapping > 0)
//Console.WriteLine("return? " + (Root.PointerMode ? "Pointer " : "Nopoint ") + (Root.FormDisplay.HasFocus() ? "Focus " : "NoFoc ") + (Root.AllowHotkeyInPointerMode ? "Allow " : "NoAll ") + Root.Snapping.ToString());

if ((Root.PointerMode||(!Root.FormDisplay.HasFocus() && !Root.AllowHotkeyInPointerMode)) || Root.Snapping > 0)
{
return;
}

//Console.WriteLine("process Keys");
//if (!AltKeyPressed() && !Root.PointerMode)//&& (SavedPen>=0 || SavedTool>=0))
if (!AltKeyPressed())
{
Expand Down
2 changes: 2 additions & 0 deletions src/FormOptions.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions src/FormOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public FormOptions(Root root)

private void FormOptions_Load(object sender, EventArgs e)
{
Root.UnsetHotkey();
//Root.UnsetHotkey();
ToolbarDwg.BackColor = Color.FromArgb(Root.ToolbarBGColor[0], Root.ToolbarBGColor[1], Root.ToolbarBGColor[2], Root.ToolbarBGColor[3]);
ToolbarOrientationBtn.BackgroundImage = ToolBarOrientationIcons[Root.ToolbarOrientation];
Clip1Btn.BackColor = ToolbarDwg.BackColor;
Expand Down Expand Up @@ -479,8 +479,12 @@ private void cbPens_CheckedChanged(object sender, EventArgs e)
}

private void FormOptions_FormClosing(object sender, FormClosingEventArgs e)
{
Root.SetHotkey();
{
try
{
Root.SetHotkey();
}
catch { }

// Save button added
//Root.SaveOptions("pens.ini");
Expand Down Expand Up @@ -915,6 +919,26 @@ private void ZoomEnabledCb_SelectedIndexChanged(object sender, EventArgs e)
Root.ZoomEnabled = ZoomEnabledCb.SelectedIndex;
}

private void hiGlobal_Enter(object sender, EventArgs e)
{
Root.UnsetHotkey();
}

private void hiGlobal_Leave(object sender, EventArgs e)
{
Root.SetHotkey();
}

private void FormOptions_Leave(object sender, EventArgs e)
{
try
{
ActiveControl.SelectNextControl(ActiveControl, true, true, false, true);
ActiveControl.SelectNextControl(ActiveControl, false, true, false, true);
}
catch { }
}

private void cbAllowHotkeyInPointer_CheckedChanged(object sender, EventArgs e)
{
Root.AllowHotkeyInPointerMode = cbAllowHotkeyInPointer.Checked;
Expand Down

0 comments on commit 1539fb7

Please sign in to comment.