question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

keyUp called when key is still pressed

See original GitHub issue
public class DesktopLauncher {
    public static void main(String[] arg) {
        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        config.width = 480;
        config.height = 320;
        new LwjglApplication(new ApplicationListener() {
            public void resume() {

            }

            @Override
            public void resize(int width, int height) {

            }

            @Override
            public void render() {
                Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
            }

            @Override
            public void pause() {

            }

            @Override
            public void dispose() {

            }

            @Override
            public void create() {
                Gdx.input.setInputProcessor(new InputProcessor() {

                    @Override
                    public boolean touchUp(int screenX, int screenY,
                            int pointer, int button) {
                        return false;
                    }

                    @Override
                    public boolean touchDragged(int screenX, int screenY,
                            int pointer) {
                        return false;
                    }

                    @Override
                    public boolean touchDown(int screenX, int screenY,
                            int pointer, int button) {
                        return false;
                    }

                    @Override
                    public boolean scrolled(int amount) {
                        return false;
                    }

                    @Override
                    public boolean mouseMoved(int screenX, int screenY) {
                        return false;
                    }

                    @Override
                    public boolean keyUp(int keycode) {
                        System.out.println("keyup");
                        return false;
                    }

                    @Override
                    public boolean keyTyped(char character) {
                        System.out.println("keytyped");
                        return false;
                    }

                    @Override
                    public boolean keyDown(int keycode) {
                        System.out.println("keydown");
                        return false;
                    }
                });
            }
        }, config);
    }
}

When a key is pressed (not release yet):

keydown
keytyped
keyup
keydown
keytyped
keyup
keydown
keytyped
keyup
keydown
keytyped
keyup
keydown
keytyped
keyup
....

Tested on iMac 2012, libgdx version 1.6.3

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jermsmcermscommented, Oct 28, 2021

Since it’s been so long I doubt anyone will see this however, it’s happening to me on windows. I have key filtering turned off.

0reactions
MobiDevelopcommented, Jul 13, 2015

Can’t reproduce on any of the “big-3” operating systems, so it must be something on your end.

I’m going to close this one out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When CMD key is kept pressed, keyup is not triggered for any ...
The problem is keyup is not being triggered for the LEFT key (or any key for that matter) as long as the CMD...
Read more >
Element: keyup event - Web APIs | MDN
The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered.
Read more >
Keyboard: keydown and keyup - The Modern JavaScript Tutorial
The keydown events happens when a key is pressed down, and then keyup – when it's released. event.code and event.key. The key property...
Read more >
.keyup() | jQuery API Documentation
The keyup event is sent to an element when the user releases a key on the keyboard. It can be attached to any...
Read more >
Keydown is the only keyboard event we need - Mutually Human
If you cancel a keydown event it will prevent the browser from performing that action. But, it will not prevent keyup from firing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found