# Key callback being called incorrectly

**URL:** <https://discourse.glfw.org/t/key-callback-being-called-incorrectly/2567>\
**Category:** support\
**Created:** [February 19, 2024, 7:27pm UTC](https://discourse.glfw.org/t/key-callback-being-called-incorrectly/2567 "2024-02-19T19:27:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brumus14](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Brumus14](https://discourse.glfw.org/u/Brumus14)\
**Post date:** [February 19, 2024, 7:27pm UTC](https://discourse.glfw.org/t/key-callback-being-called-incorrectly/2567/1 "2024-02-19T19:27:08Z")

</div>

Hello I’m using GLFW for input in my project and I’m using the glfwSetKeyCallback function and it is working fine detecting when a key is pressed and released, however when using some keys are held down after about 1 second the release callback is called, another weird thing about this behavior is that if 4 keys are held at once then only one will be incorrectly release called and the others will still work. If anyone could help me on why this is happening.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [February 19, 2024, 7:43pm UTC](https://discourse.glfw.org/t/key-callback-being-called-incorrectly/2567/2 "2024-02-19T19:43:08Z")

</div>

Hi @Brumus14,

Welcome to the GLFW forum.

> [@Brumus14](#):
>
> however when using some keys are held down after about 1 second the release callback is called

Are you certain it is called with `GLFW_RELEASE` and not `GLFW_REPEAT`?

> [@Brumus14](#):
>
> , another weird thing about this behavior is that if 4 keys are held at once then only one will be incorrectly release called and the others will still work

This could be due to the keyboard not being able to handle multiple key presses, see [this Wikipedia article on multi-key rollover](https://en.wikipedia.org/wiki/Key_rollover#Multi-key_rollover).

If the above aren’t the issue it would be a good idea to test with the `events.c` test program to check if that has the same issue as your own code.

---

<div class="post-metadata">

**Author:** ![Brumus14](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Brumus14](https://discourse.glfw.org/u/Brumus14)\
**Post date:** [February 19, 2024, 7:54pm UTC](https://discourse.glfw.org/t/key-callback-being-called-incorrectly/2567/3 "2024-02-19T19:54:15Z")

</div>

That was the issue, I wasn’t checking for the repeat calls.  
Thanks.
