pass in mainform to Keyboard.cs instead of using global
This commit is contained in:
parent
9f86a2db6a
commit
eb438fd9cb
|
@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateThread.Start();
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
public static void Initialize(Control parent)
|
||||
{
|
||||
if (OSTailoredCode.IsUnixHost)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
KeyInput.Initialize();
|
||||
KeyInput.Initialize(parent);
|
||||
IPCKeyInput.Initialize();
|
||||
GamePad.Initialize();
|
||||
GamePad360.Initialize();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using SlimDX;
|
||||
using SlimDX.DirectInput;
|
||||
|
||||
|
@ -11,7 +12,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private static DirectInput _directInput;
|
||||
private static Keyboard _keyboard;
|
||||
|
||||
public static void Initialize()
|
||||
public static void Initialize(Control parent)
|
||||
{
|
||||
lock (SyncObj)
|
||||
{
|
||||
|
@ -20,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_directInput = new DirectInput();
|
||||
|
||||
_keyboard = new Keyboard(_directInput);
|
||||
_keyboard.SetCooperativeLevel(GlobalWin.MainForm.Handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive);
|
||||
_keyboard.SetCooperativeLevel(parent.Handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive);
|
||||
_keyboard.Properties.BufferSize = 8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Sound?.StartSound();
|
||||
};
|
||||
|
||||
Input.Initialize();
|
||||
Input.Initialize(this);
|
||||
InitControls();
|
||||
|
||||
CoreFileProvider.SyncCoreCommInputSignals(comm);
|
||||
|
|
Loading…
Reference in New Issue