Skip to content

Sometimes command-key or shift-key get stuck, in Perry #9

@gamblevore

Description

@gamblevore

So, sometimes, but not always... the keyboard will get "stuck" in Perry.

It will believe that the command-key is down, when it is not. Or the same for the shift-key. Somehow the option-key doesn't seem to have this issue? Not sure why?

This happens when switching to another program via Cmd-Tab on OSX-ARM-64, then switching back again via Cmd-Tab.

I didn't check if this happens via mouse-click switches. Maybe I should try that next.

This bug happens around half the time. but not reliably. Which again... makes it hard to reproduce, because while stepping through a large amount of code, I don't know if "this time" is the time that things will go wrong.

I've tried to solve it about 4x already. Each time I've failed. Each time I spent half a day or more (maybe a whole day) trying to solve it. I can't... I have no idea what is wrong.

I even re-wrote the keyboard system twice. To simplify it to make it "less likely to go wrong". The bug still persisted.

I've tried various approaches, each different to the other. Such as:

  • Checking the global keyboard state as reported by SDL2, after switching back to Perry, instead of using the keyup/keydown events
  • Ignoring keyboard events at a certain time (after foreground switch)
  • Logging all keyboard and switch-events to see if I can see any patterns (I couldn't figure it out)

Very frustrating bug.

My guess is that it is a bug in SDL2 itself. Which is why I can't solve it.

Perhaps someone who knows about SDL2 can help fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions