This commit is contained in:
adelikat 2019-12-22 13:58:00 -06:00
parent 60c789df22
commit 0b57b4c5f6
3 changed files with 12 additions and 22 deletions

View File

@ -166,9 +166,9 @@ namespace BizHawk.Client.EmuHawk
public readonly string Button; public readonly string Button;
public readonly ModifierKey Modifiers; public readonly ModifierKey Modifiers;
public bool Alt { get { return ((Modifiers & ModifierKey.Alt) != 0); } } public bool Alt => (Modifiers & ModifierKey.Alt) != 0;
public bool Control { get { return ((Modifiers & ModifierKey.Control) != 0); } } public bool Control => (Modifiers & ModifierKey.Control) != 0;
public bool Shift { get { return ((Modifiers & ModifierKey.Shift) != 0); } } public bool Shift => (Modifiers & ModifierKey.Shift) != 0;
public override string ToString() public override string ToString()
{ {
@ -257,8 +257,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
LogicalButton buttonModifierState; if (ModifierState.TryGetValue(button, out var buttonModifierState))
if (ModifierState.TryGetValue(button, out buttonModifierState))
{ {
if (buttonModifierState != ie.LogicalButton && !IgnoreEventsNextPoll) if (buttonModifierState != ie.LogicalButton && !IgnoreEventsNextPoll)
{ {
@ -312,8 +311,7 @@ namespace BizHawk.Client.EmuHawk
{ {
lock (this) lock (this)
{ {
if (InputEvents.Count == 0) return null; return InputEvents.Count == 0 ? null : InputEvents.Dequeue();
else return InputEvents.Dequeue();
} }
} }
void EnqueueEvent(InputEvent ie) void EnqueueEvent(InputEvent ie)

View File

@ -16,14 +16,14 @@ namespace BizHawk.Client.EmuHawk
public string ButtonName public string ButtonName
{ {
get { return ButtonNameLabel.Text; } get => ButtonNameLabel.Text;
set { ButtonNameLabel.Text = value; } set => ButtonNameLabel.Text = value;
} }
public double Probability public double Probability
{ {
get { return (double)ProbabilityUpDown.Value; } get => (double)ProbabilityUpDown.Value;
set { ProbabilityUpDown.Value = (decimal)value; } set => ProbabilityUpDown.Value = (decimal)value;
} }
private void ProbabilityUpDown_ValueChanged(object sender, EventArgs e) private void ProbabilityUpDown_ValueChanged(object sender, EventArgs e)
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_programmaticallyChangingValues = true; _programmaticallyChangingValues = true;
ProbabilitySlider.Value = (int)ProbabilityUpDown.Value; ProbabilitySlider.Value = (int)ProbabilityUpDown.Value;
ChangedCallback(); ProbabilityChangedCallback?.Invoke();
_programmaticallyChangingValues = false; _programmaticallyChangingValues = false;
} }
} }
@ -43,17 +43,9 @@ namespace BizHawk.Client.EmuHawk
{ {
_programmaticallyChangingValues = true; _programmaticallyChangingValues = true;
ProbabilityUpDown.Value = ProbabilitySlider.Value; ProbabilityUpDown.Value = ProbabilitySlider.Value;
ChangedCallback(); ProbabilityChangedCallback?.Invoke();
_programmaticallyChangingValues = false; _programmaticallyChangingValues = false;
} }
} }
private void ChangedCallback()
{
if (ProbabilityChangedCallback != null)
{
ProbabilityChangedCallback();
}
}
} }
} }

View File

@ -91,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
protected void RefreshFloatingWindowControl(bool floatingWindow) protected void RefreshFloatingWindowControl(bool floatingWindow)
{ {
Owner = floatingWindow ? null : GlobalWin.MainForm; Owner = floatingWindow ? null : MainForm;
} }
protected bool IsOnScreen(Point topLeft) protected bool IsOnScreen(Point topLeft)