TheInput:IsKeyDown(KEY_ALT) always gets stuck


CossonWool
  • Pending

When you alt+tab, the alt key gets stuck and returns true after the alt key is releasing for TheInput:IsKeyDown(KEY_ALT). This happens 100% of the time.

This doesn't happen for TheInput:IsControlPressed(CONTROL_FORCE_INSPECT) where CONTROL_FORCE_INSPECT is alt (which is the default).

Both functions are checking if a key is currently pressed/down, and they are returning different outputs, unless I'm misunderstanding something this is a bug.

This isn't limited to just KEY_ALT, it's any keys that are held down during the alt+tab process. For example, if someone holds shift+alt+tab, then alt+tab back into the game, TheInput:IsKeyDown(KEY_SHIFT) will also return true even though shift hasn't been down since the initial alt+tab. It's just easier to use KEY_ALT as a main example since it sticks every time.

This doesn't effect gameplay much since almost all everything in the game uses IsControlPressed, but a lot of mods use IsKeyDown for keybind related settings in modconfigs, and they suffer from buggy behaviour because of this.

I'm using Windows 10 if that matters.


Steps to Reproduce
1. have CONTROL_FORCE_INSPECT be alt ("Left Alt"; which it is by default) 2. alt+tab out of dst 3. alt+tab back into dst, but don't press alt again for the rest of the testing (so it doesn't change state) 4. locally run the command: print(tostring(TheInput:IsKeyDown(KEY_ALT))) 5. locally run the command: print(tostring(TheInput:IsControlPressed(CONTROL_FORCE_INSPECT))) 6. notice the output is true and false respectively even though they are checking the same key

Status: Pending

This issue has not been confirmed by a developer yet.


  • Like 1
  Report Bug


User Feedback


....

One is a polling method and the other is an event driven system.

In Windows when you alt-tab out of a program it no longer has focus and thus key events don't fire.  So holding down a key and then switching focus won't fire the key-up event.

  • Like 1

Share this comment


Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now