Skip to content

Commit

Permalink
#20 WinForms can't easily distinguish between left/right Control, use…
Browse files Browse the repository at this point in the history
… Alt (Menu) for Commodore key

Suppress Alt-key to not open menu
  • Loading branch information
hagronnestad committed Nov 11, 2022
1 parent 28230c2 commit bb585ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ComputerSystems/Commodore64/FormC64Screen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ private void FormC64Screen_KeyUp(object sender, KeyEventArgs e) {
KeysDown.Remove(e.KeyCode);
}

if (e.Alt) e.SuppressKeyPress = true;

Debug.WriteLine("KeyUp: " + String.Join(", ", KeysDown.Select(x => x.ToString())));
}
Expand Down Expand Up @@ -706,6 +707,7 @@ private void FormC64Screen_KeyDown(object sender, KeyEventArgs e)
if (!KeysDown.Contains(e.KeyCode)) KeysDown.Add(e.KeyCode);
}

if (e.Alt) e.SuppressKeyPress = true;

Debug.WriteLine("KeyDown: " + String.Join(", ", KeysDown.Select(x => x.ToString())));
}
Expand Down
2 changes: 1 addition & 1 deletion ComputerSystems/Commodore64/Keyboard/C64Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class C64Keyboard
{ Keys.D9, Keys.I, Keys.J, Keys.D0, Keys.M, Keys.K, Keys.O, Keys.N },
{ Keys.Oemplus, Keys.P, Keys.L, Keys.Oem4, Keys.OemPeriod, Keys.Oem3, Keys.Oem6, Keys.Oemcomma },
{ Keys.Oem102, Keys.Oem1, Keys.Oem7, Keys.Home, Keys.ShiftKey, Keys.Oem2, Keys.PageUp, Keys.OemMinus },
{ Keys.D1, Keys.Escape, Keys.LControlKey, Keys.D2, Keys.Space, Keys.RControlKey, Keys.Q, Keys.Pause },
{ Keys.D1, Keys.Escape, Keys.ControlKey, Keys.D2, Keys.Space, Keys.Menu, Keys.Q, Keys.Pause },
};

// This shows the actual keyboard matrix for a C64 keyboard.
Expand Down

0 comments on commit bb585ae

Please sign in to comment.