bsnes-plus
bsnes-plus copied to clipboard
Unable to regain keyboard focus after sleep/lock
If my computer goes to sleep or I lock it while bsnes-plus is running, when I return, it refuses to accept any input unless I completely close the program and reopen. It doesn't crash, emulation resumes normally when you click on the window, but you can't press any keys.
Interesting. I assume this is under Windows?
Sorry, yes. Windows 7 x64.
Funny, I was going to report a similar issue: This also applies when disconnecting and reconnecting the mouse/keyboard while bsnes-plus is running. (I use a KVM switch on a regular basis so I tripped over this.) All the dialogues work fine (debugger, settings, etc.) but the main emulation window doesn't pick up any keyboard events anymore. (Windows 10 x64)
Yes, I guess I wasn't very clear about the symptoms. Input into all of the secondary windows, config dialogs, etc works fine, I can click things, the UI responds, etc. It's just the emulation itself that stops responding to input.
In both cases, does it make a difference which input driver you're using (directinput / rawinput)?
Just tested, it happens on both input drivers.
Good point. For me only RawInput is affected. (Changing the input driver only "took" after restarting bsnes-plus)
Took a look now that I'm at home, seems to happen to me with both input drivers, so the actual issue may be somewhere else.
I don't have the same issue with higan v098, so I'll do a quick comparison in a bit.
I just looked into this a bit more, and I actually think I know what's happening. It's not actually losing keyboard focus, it thinks one of the modifier keys is held down when it isn't. After locking my computer and returning to find these symptoms, I opened up the input configuration and tried binding a key, only to find that it registered Ctrl+(the key I pressed) even though Ctrl wasn't pressed at all. Another time, same thing except with Super instead of Ctrl. So it's still registering input just fine, it's just borking the modifier state, resulting in keypresses not being processed as expected.
Interesting, good catch. I'll see what I can do about that.
In the meantime, at least I can work around the issue by mashing all of my modifier keys until they register properly. Before, I was just having to savestate and then close/reopen the emulator.
Testing it more, rawinput and DirectX both continue to indicate that whatever modifier keys were down when locking are still down when unlocking, for some reason, so something is missing key release events once the lock happens. Not really sure what or why though.