Hotkey/controller config: Fix issue where input events get queued and processed by the main form after the dialog is closed. For example if you opened the hotkey config, typed "-" in the search box, and closed the dialog, it would trigger Decrease Speed in the main form. Also redo an old hack fix the right way.
This commit is contained in:
parent
09314bdeda
commit
23433b856f
|
@ -293,7 +293,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
private ModifierKey _Modifiers;
|
||||
private readonly List<InputEvent> _NewEvents = new List<InputEvent>();
|
||||
|
||||
//do we need this?
|
||||
public void ClearEvents()
|
||||
{
|
||||
lock (this)
|
||||
|
|
|
@ -302,7 +302,8 @@
|
|||
this.Name = "ControllerConfig";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Controller Config";
|
||||
this.Load += new System.EventHandler(this.NewControllerConfig_Load);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ControllerConfig_FormClosed);
|
||||
this.Load += new System.EventHandler(this.ControllerConfig_Load);
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
|
|
|
@ -49,7 +49,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
ControllerImages.Add("Apple IIe Keyboard", Properties.Resources.AppleIIKeyboard);
|
||||
ControllerImages.Add("VirtualBoy Controller", Properties.Resources.VBoyController);
|
||||
ControllerImages.Add("NeoGeo Portable Controller", Properties.Resources.NGPController);
|
||||
|
||||
}
|
||||
|
||||
private ControllerConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnActivated(EventArgs e)
|
||||
|
@ -64,13 +68,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
Input.Instance.ControlInputFocus(this, Input.InputFocus.Mouse, false);
|
||||
}
|
||||
|
||||
private ControllerConfig()
|
||||
private void ControllerConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
InitializeComponent();
|
||||
Closing += (o, e) =>
|
||||
{
|
||||
buttonOK.Focus(); // A very dirty hack to avoid https://code.google.com/p/bizhawk/issues/detail?id=161
|
||||
};
|
||||
Text = $"{_theDefinition.Name} Configuration";
|
||||
}
|
||||
|
||||
private void ControllerConfig_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Input.Instance.ClearEvents();
|
||||
}
|
||||
|
||||
private delegate Control PanelCreator<T>(Dictionary<string, T> settings, List<string> buttons, Size size);
|
||||
|
@ -365,11 +370,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
private void NewControllerConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
Text = $"{_theDefinition.Name} Configuration";
|
||||
}
|
||||
|
||||
private static TabControl GetTabControl(IEnumerable controls)
|
||||
{
|
||||
if (controls != null)
|
||||
|
|
|
@ -228,7 +228,8 @@
|
|||
this.Name = "HotkeyConfig";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Configure Hotkeys";
|
||||
this.Load += new System.EventHandler(this.NewHotkeyWindow_Load);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.HotkeyConfig_FormClosed);
|
||||
this.Load += new System.EventHandler(this.HotkeyConfig_Load);
|
||||
this.HotkeyTabControl.ResumeLayout(false);
|
||||
this.clearBtnContextMenu.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
|
|
@ -14,11 +14,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
Closing += (o, e) =>
|
||||
{
|
||||
IDB_SAVE.Focus(); // A very dirty hack to avoid https://code.google.com/p/bizhawk/issues/detail?id=161
|
||||
};
|
||||
|
||||
tabPage1.Focus();
|
||||
}
|
||||
|
||||
|
@ -34,7 +29,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Input.Instance.ControlInputFocus(this, Input.InputFocus.Mouse, false);
|
||||
}
|
||||
|
||||
private void NewHotkeyWindow_Load(object sender, EventArgs e)
|
||||
private void HotkeyConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
var source = new AutoCompleteStringCollection();
|
||||
source.AddRange(Global.Config.HotkeyBindings.Select(x => x.DisplayName).ToArray());
|
||||
|
@ -47,6 +42,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
DoFocus();
|
||||
}
|
||||
|
||||
private void HotkeyConfig_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Input.Instance.ClearEvents();
|
||||
}
|
||||
|
||||
private void IDB_CANCEL_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Hotkey config aborted");
|
||||
|
|
|
@ -88,6 +88,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected override void OnEnter(EventArgs e)
|
||||
{
|
||||
Input.Instance.ClearEvents();
|
||||
_lastPress = null;
|
||||
_timer.Start();
|
||||
BackColor = Color.FromArgb(unchecked((int)0xFFC0FFFF)); // Color.LightCyan is too light on Windows 8, this is a bit darker
|
||||
|
@ -101,6 +102,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
base.OnLeave(e);
|
||||
}
|
||||
|
||||
protected override void OnHandleDestroyed(EventArgs e)
|
||||
{
|
||||
_timer.Stop();
|
||||
base.OnHandleDestroyed(e);
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
ReadKeys();
|
||||
|
|
Loading…
Reference in New Issue