Post

Note for Windows PC users - apologies for the shift keys not working properly. I've mapped left shift to CAPS SHIFT and right shift to SYMBOL SHIFT. For some reason a KEYUP event consistently goes missing when you hold both shift keys then release one or both. Works fine on Linux and Mac.

windows treats modifier state as unified , e.g. here both shift keys, but will only send one keyup when the last is released. you can call getkeystate for vk_lshit and rshift on every shift event (keyup, down, syskeyup, etc) like bool ls = GetKeyState(VK_LSHIFT) & 0x8000) != 0 . or raw input.

Indeed, that's pretty much what I'm seeing, and I can also confirm that the shift keys can be read correctly using GetKeyState. The key up/down events are all I've got to work with at the moment as it needs to be cross-platform. I'll come back to it when I've got more time on my hands.

The plan (at the moment) will be to avoid using keydown/up events and just scan the required keystates. I like the idea of using left and right shift keys as it feels natural (as a ZX Spectrum owner). Might have a crack at it this weekend.

0 reposts2 likes

Yeah, it's not really a biggie to be honest. Whilst it would be nice to use both shift keys, I can use something like left shift / alt-gr and still get the desired user experience across all platforms (desktop and webasm). It is kind of interesting how little things like this can trip one up!

wasm is subject to whatever the browser does. Have you checked whether Chrome on Windows suffers from the two-shift problem? There may be exactly this OS-specific fix there already. But a #ifdef _WIN32 would allow you to fix it for native Windows builds.