Set `Form.Owner` to MainForm for Lua-made forms
This commit is contained in:
parent
3fddcdb2c5
commit
94e85f1079
|
@ -17,6 +17,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public FormsLuaLibrary(IPlatformLuaLibEnv luaLibsImpl, ApiContainer apiContainer, Action<string> logOutputCallback)
|
public FormsLuaLibrary(IPlatformLuaLibEnv luaLibsImpl, ApiContainer apiContainer, Action<string> logOutputCallback)
|
||||||
: base(luaLibsImpl, apiContainer, logOutputCallback) {}
|
: base(luaLibsImpl, apiContainer, logOutputCallback) {}
|
||||||
|
|
||||||
|
public Form MainForm { get; set; }
|
||||||
|
|
||||||
public override string Name => "forms";
|
public override string Name => "forms";
|
||||||
|
|
||||||
private readonly List<LuaWinform> _luaForms = new List<LuaWinform>();
|
private readonly List<LuaWinform> _luaForms = new List<LuaWinform>();
|
||||||
|
@ -352,6 +354,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
form.MaximizeBox = false;
|
form.MaximizeBox = false;
|
||||||
form.FormBorderStyle = FormBorderStyle.FixedDialog;
|
form.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||||
form.Icon = SystemIcons.Application;
|
form.Icon = SystemIcons.Application;
|
||||||
|
form.Owner = MainForm;
|
||||||
form.Show();
|
form.Show();
|
||||||
|
|
||||||
form.FormClosed += (o, e) =>
|
form.FormClosed += (o, e) =>
|
||||||
|
|
|
@ -96,6 +96,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
consoleLib.Tools = _mainForm.Tools;
|
consoleLib.Tools = _mainForm.Tools;
|
||||||
_logToLuaConsoleCallback = consoleLib.Log;
|
_logToLuaConsoleCallback = consoleLib.Log;
|
||||||
}
|
}
|
||||||
|
else if (instance is FormsLuaLibrary formsLib)
|
||||||
|
{
|
||||||
|
formsLib.MainForm = _mainForm;
|
||||||
|
}
|
||||||
else if (instance is GuiLuaLibrary guiLib)
|
else if (instance is GuiLuaLibrary guiLib)
|
||||||
{
|
{
|
||||||
// emu lib may be null now, depending on order of ReflectionCache.Types, but definitely won't be null when this is called
|
// emu lib may be null now, depending on order of ReflectionCache.Types, but definitely won't be null when this is called
|
||||||
|
|
Loading…
Reference in New Issue