BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

"Accept background input" Does not work with Lua Console / Lua Scripts

Open weatherton opened this issue 7 years ago • 5 comments

AcceptBackgroundInput_Test.zip

What steps will reproduce the problem?

  1. Open BizHawk, Tools -> Config -> Customize -> Check "Accept background input"
  2. Open a ROM and then switch focus to another application and hit frame advance hotkey and note that BizHawk does still respond
  3. Open the Lua Console and keep focus on the console, hit frame advance hotkey. BizHawk does not respond
  4. Run any Lua script that creates a window (example attached) and keep focus on the window, hit frame advance hotkey. BizHawk does not respond

What is the expected output? What do you see instead? Expected: BizHawk would respond to input when focus is on Lua Console or Lua Script (Ideally there would even be an option to "Accept background input from any BizHawk-generated window" or something to that effect. But at least it would be good to have the current option function across BizHawk generated windows. Actual: BizHawk does not respond to input when focus is on Lua Console or Lua Script

What version of the product are you using? On what operating system? Emuhawk 1.11.6 on Windows 10

weatherton avatar Jul 23 '16 19:07 weatherton

I dont' think it should be expected at all that "Accept background input" works on tool dialogs of bizhawk itself. Each tool has to decide to accept mainform input. Tools like tastudio do this (and it is a very tricky thing to consider). If I could edit this ticket I would change it to request mainform input on the lua console and lua created dialogs.

adelikat avatar Nov 09 '16 16:11 adelikat

Persists in 2.3.1. Easiest "solution" is to change When this is set, the client will receive user input even when focus is lost to When this is set, the client will receive keyboard and controller input when another program is focused, or similar, and close as wontfix.

YoshiRulz avatar Feb 04 '19 20:02 YoshiRulz

Is there a way to configure an external tool to ignore controller input and let the client handle it normally?

fenhl avatar Oct 16 '20 08:10 fenhl

Not sure. You can definitely do it with a hack: overwrite MainFormInputAllowedCallback on the global Input.Instance (usually set once on program launch here) to add IExternalToolForm to the allowlist (here).

YoshiRulz avatar Oct 16 '20 08:10 YoshiRulz

The hack has become a feature (as of 7596b9721). Have your ext. tool form inherit FormBase and override BlocksInputWhenFocused, like Virtual Pads does (though see #3087 for why this naïve implementation had to be replaced): https://github.com/TASEmulators/BizHawk/blob/7596b9721855d1a36b47d8f26bdb08a1a163c052/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs#L25


Back on-topic, the Lua Console could override BlocksInputWhenFocused with something that returns true when the console textbox, script list, or menu bar is focused, but... that sounds really hard. I think we should wontfix this issue.

YoshiRulz avatar Nov 21 '20 12:11 YoshiRulz

Open for 7 years? Yeah let's close wontfix

TiKevin83 avatar Aug 28 '23 13:08 TiKevin83

Hotkeys are broken in other ways too, even on Windows... It's just hard to do this right with WinForms. Remember also the mouse isn't passed through (the prop should be BlocksKeyEventsWhenFocused I guess).

I'll be changing the setting's description as above.

YoshiRulz avatar Aug 29 '23 02:08 YoshiRulz