processing / processing/processing4
keyPressed() does not always fire after starting sketch
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 494
- Fork
- 183
- Merge medio
- 4h 39m
- PR unite (30g)
- 3
Descrizione
Created by: sterretjeToo
When starting a sketch from the IDE or running an exported sketch, it does not always react on keyboard input; sometimes one has to click inside the drawn area. So it looks like a started sketch does not have the focus; clicking on the titlebar in the window does not solve the issue.
The below sketch (running in the IDE) produces the issue (as said, it sometimes works correctly, sometime not).
void setup()
{
size(400, 200);
}
void draw()
{
}
void keyPressed()
{
println("keyPressed()");
}
Expected behaviour
The expected behaviour is that at the moment that the sketch runs and a key is pressed, the message "keyPressed()" shows.
System information
Second gen Intel I3 with 8GB memory and integrated Intel Graphics (AsRock H61M VS-R2.0)
Windows 10 Home
Processing 4.3; the issue was also observed in Processing 4.2)
Workaround
https://discourse.processing.org/t/keypressed-only-works-sometimes/22340 (July 1920) contains a (possible) workaround by using the below line in setup()
surface.setVisible(true);
For now, it seems to have solved the issue. I will provide feedback if I still encounter the issue with the above workaround.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esegui lo sketch minimo fornito sia dall’IDE sia in uno sketch esportato su Windows, verificando se keyPressed() viene attivato immediatamente senza fare clic sull’area di disegno. Inizia confrontando il comportamento di avvio dello sketch e il comportamento del focus e della visibilità della finestra, incluso il workaround segnalato surface.setVisible(true). Il lavoro è completato quando l’input da tastiera funziona in modo affidabile immediatamente dopo l’avvio in entrambi i casi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- desktop
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100