processing / processing/processing4
keyPressed() does not always fire after starting sketch
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 494
- Forks
- 183
- Ø Merge
- 4 Std. 39 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe die bereitgestellte minimale Skizze sowohl aus der IDE als auch als exportierte Skizze unter Windows aus und teste, ob keyPressed() sofort ausgelöst wird, ohne in den Zeichenbereich zu klicken. Beginne mit dem Vergleich des Startverhaltens der Skizze sowie des Fokus-/Sichtbarkeitsverhaltens des Fensters, einschließlich des gemeldeten Workarounds surface.setVisible(true). Erledigt ist die Aufgabe, wenn die Tastatureingabe in beiden Fällen direkt nach dem Start zuverlässig funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- desktop
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100