stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
112 stars 57 forks source link

Emulated Shift/Ctrl keys get stuck down when I press Ctrl-Shift-Escape #139

Closed ZornsLemma closed 3 years ago

ZornsLemma commented 3 years ago

Sorry, this might be a fiddly one...

I'm running the MATE desktop on Ubuntu 20.04.2 LTS on a VirtualBox VM. I found out by accident that if you press Ctrl-Shift-Escape that brings up a "System Monitor".

If I do this when a b-em window has the focus, letting go of Escape but keeping the Shift+Ctrl keys held down until after the "System Monitor" has appeared, Shift and/or Ctrl on the emulated seem to get permanently stuck down - even doing File->Hard Reset doesn't fix things, I have to kill the emulator and restart it.

I originally had logical keyboard mode on when I found this, but I've turned it off (so the emulator starts up with it off) and it doesn't seem to make any difference.

I haven't tried to investigate this in any depth yet. It may be a virtual machine issue so I'm interested to see if you can reproduce it. I suspect having focus taken away from b-em while SHIFT and/or CTRL are held down is the key part of the problem.

I'm seeing this on commit b672bf0ad441c3c286b17b4efbe604d4fcc6aecf.

SteveFosdick commented 3 years ago

Does simply re-pressing the keys solve it. I think the issue is that b-em sees the key down/key char event but never the key up event. Pressing the keys again should generate a key up. I'll have a think if there is a better fix when I have more time.

ZornsLemma commented 3 years ago

You're right, re-pressing the keys solves it, thanks!

SteveFosdick commented 3 years ago

See https://github.com/stardot/b-em/tree/sf/issue139 for a fix. Strangely the key_focus_lost function already existed so it's call may have been something that got lost in merging.

ZornsLemma commented 3 years ago

Sorry for the delay in getting back to you on this. I can't reproduce this with the sf/issue139 branch, so it looks like the fix works fine. Thanks very much!

SteveFosdick commented 3 years ago

Thanks, Steve. I have merged that branch into master and I will close this.