libgdx / libgdx/libgdx

[Bug] Gdx.input.isKey(Just)Pressed(Keys.BACKSLASH), doesn't seem to work on Linux Mint 18 KDE Edition

Open
#4,533 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug desktop
Dominant language
Java
Stars
25.4k
Forks
6.5k
Avg merge
1d 16h
Merged PRs (30d)
5

Description

Issue details

Gdx.input.isKeyJustPressed(Keys.BACKSLASH) and Gdx.input.isKeyPressed(Keys.BACKSLASH) wont work on Linux Mint 18 KDE Edition, on windows it works fine, but on Linux it doesn't give any output. KeyUp and KeyDown from InputProcessor won't respond to backslash although KeyTyped will respond appropriately, thus a workaround is to check when KeyTyped returns '\'.

I tested this with the same keyboard layout and using Linux Mint 18 KDE Edition and Windows 10

The backslash will work to open (for example) CSGO's console.

Reproduction steps/code
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class DasTesten extends ApplicationAdapter {
	SpriteBatch batch;
	Texture img;
	
	//When false, displays libgdx logo, when true it won't
	private boolean testen = false;
	
	@Override
	public void create () {
		batch = new SpriteBatch();
		img = new Texture("badlogic.jpg");
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(1, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

		//Test #1, won't work on Linux (Tested on Linux Mint 18 KDE Edition)
		if(Gdx.input.isKeyJustPressed(Keys.BACKSLASH)){
			testen = !testen;
		}
		
		//Test #2, must work everywhere
		if(Gdx.input.isKeyJustPressed(Keys.A)){
			testen = !testen;
		}
		
		//The outcome
		if(!testen){
			batch.begin();
			batch.draw(img, 0, 0);
			batch.end();
		}
	}
	
	@Override
	public void dispose () {
		batch.dispose();
		img.dispose();
	}
}

Then try pressing backslash (I am using an PT-PT Keyboard layout so the backslash key is above tab)

Version of LibGDX and/or relevant dependencies

1.9.5

Stacktrace

N/A

Please select the affected platforms
  • Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the sample with Gdx.input.isKeyJustPressed(Keys.BACKSLASH) on Linux Mint 18 KDE and compare it with Keys.A. Trace the Linux input path for InputProcessor keyDown, keyUp, and keyTyped events; done means BACKSLASH polling and key events behave consistently while existing Windows behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.